This is a multi-part problem:
I am creating an RSVP page for my wedding website.
I have all the guests in a mySQL database.
The way I have it work is you go to the rsvp webpage, enter the “rsvp code” and all of those people linked with the rsvp code will show up.
Each person has a radio button.
PROBLEM:
Because I am gathering everyone who has the rsvp code in a while loop, to get the radio buttons to display with different names I had to give the radio button name a unique identifier and I based that off of the database id number.
Example: If 3 people identify with a given rsvp code, then using the code below,
<input type="radio" name="attending[COLOR="Red"]$id[/COLOR]" value="1">
<input type="radio" name="attending[COLOR="Red"]$id[/COLOR]" value="2">
will produce:
Person 1 “Radio buttons where id = 1”
Person 2 “Radio buttons where id = 2”
Person 3 “Radio buttons where id = 3”
Now each person has a unique radio button to RSVP to.
Upon pressing submit I’m having trouble passing everyone’s information into a mySQL UPDATE query.
Here is the website you can check it out. Type: 12345 as the code.
http://www.viglucci.com/wedding/rsvp.php
Here is the code.
echo "<form action=\\"rsvp/rsvp_updated.php\\" method=\\"post\\">";
echo "<table>";
echo "<tr> <th class=\\"la\\">Attending:</th> <th class=\\"la\\">Yes</th><th class=\\"la\\">No </tr>";
// keeps getting the next row until there are no more to get
while($user = mysql_fetch_array( $result )) {
$fname = ($user['fname']);
$lname = ($user['lname']);
$email = ($user['email']);
$phone = ($user['phone']);
$address = ($user['address']);
$city = ($user['city']);
$state = ($user['state']);
$zipcode = ($user['zipcode']);
$attending = ($user['attending']);
$guest_name = ($user['guest_name']);
$code = ($user['code']);
$id = ($user['id']);
// Print out the contents of each row into a table
echo "<tr><td class=\\"white_text\\">";
echo "$fname $lname";
echo "</td><td>";
echo "<input align=\\"baseline\\" type=\\"radio\\" name=\\"attending$id\\" value=\\"1\\">";
echo "</td><td>";
echo "<input align=\\"baseline\\" type=\\"radio\\" name=\\"attending$id\\" value=\\"2\\">";
echo "</td><td>";
echo "<input name=\\"id\\" type=\\"hidden\\" value=\\"$id\\" />";
echo "<input name=\\"fname\\" type=\\"hidden\\" value=\\"$fname\\" />";
echo "<input name=\\"lname\\" type=\\"hidden\\" value=\\"$lname\\" />";
echo "</td></tr>";
}
echo "</table>";
echo "<span class=\\"padding\\"><input name=\\"Update\\" type=\\"submit\\" value=\\"Update\\" /></span>";