Example #1
0
    }
    //insert creator of trip to participants table
    $sql2 = "INSERT INTO participants (trip_id, user_id) VALUES ('{$trip_id}', '{$tripUserId}')";
    if (mysqli_query($conn, $sql2)) {
    } else {
        echo "Error: " . $sql2 . "<br>" . mysqli_error($conn);
    }
    //Select the userID of the invited user
    $part_id = getUserId($partEmail);
    //Insert invited user ID, tripID to participants table
    insertParticipant($trip_id, $part_id);
} else {
    echo "Something is wrong!";
    //Something wrong with the trip ID
}
$participants = getParticipants($trip_id);
//Display input for adding expenses
echo "<h1>" . $tripName . "</h1>";
echo "Add an expense below!";
echo '<form action="expenses/submit.php" method="post">';
echo 'Expense Name: <input type="text" name="expenseTitle" id="expenseTitle"><br>';
echo 'Cost: <input type="text" name="expenseCost" id="expenseCost"><br>';
echo 'Number of Purchasers: <input type="text" name="expensePurchasers" id="expensePurchasers"><br>';
echo 'Number of Users: <input type="text" name="expenseUsers" id="expenseUsers"><br>';
echo '<select name="purchasers" multiple>';
while ($info = mysqli_fetch_array($participants)) {
    echo '<option value="' . $info['user_name'] . '[]">' . $info['user_name'] . '</option>';
}
echo '</select>';
echo '<input type="hidden" name="tripId" value="' . $trip_id . '">';
echo '<input type="submit">';
Example #2
0
    }
}
$comment = getComments($_GET['id']);
$contents['comment'] = $comment;
$i = 0;
foreach ($contents['comment'] as $commentateur) {
    $commentateur_photo = getMembersPicture($commentateur['id']);
    if ($commentateur_photo) {
        $contents['comment'][$i]['picture'] = PHOTO_PROFIL . $commentateur_photo[0];
        $i++;
    } else {
        $contents['comment'][$i]['picture'] = IMAGES . "photo_profil_defaut.jpg";
        $i++;
    }
}
$participants = getParticipants($_GET['id']);
$contents['participants'] = $participants;
$i = 0;
foreach ($contents['participants'] as $participant) {
    $participant_photo = getMembersPicture($participant['id']);
    if ($participant_photo) {
        $contents['participants'][$i]['picture'] = PHOTO_PROFIL . $participant_photo[0];
        $i++;
    } else {
        $contents['participants'][$i]['picture'] = IMAGES . "photo_profil_defaut.jpg";
        $i++;
    }
}
$adresse = getAdress($_GET['id']);
$contents['adresse'] = $adresse;
$contents['tarif'] = $event['tarif'];