Jump to content

Recommended Posts

hey all,

 

I'm having trouble with the script that I've written here. This is a script that is for RSVPs to various events (it's supposed to be very dynamic with the $_GET feature included). Problem explained after code. Seems to be a basic problem but I just can't get it.

 

here's rsvp.php (the form):

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RSVP to an Event</title>

</head>

<body>
<p>
		<?php

			$eventTitle = $_GET["eventTitle"];
			$eventTime = $_GET["eventTime"];
			$eventDate = $_GET["eventDate"];

		?>
  RSVP to an Event!
  <br />
  <br />
  <br />


</p>
<form id="rsvp" name="rsvp" method="post" action="rsvp2.php">
<?php 
echo stripslashes($eventTitle);
echo "<br><br>$eventTime on $eventDate<br><br>";
?>
  	<input type="hidden" name"eventTitle" id="eventTitle" value="<?php $eventTitle ?>" />
  	<input type="hidden" name"eventTime" id="eventTime" value="<?php $eventTime ?>" />
  	<input type="hidden" name"eventDate" id="eventDate" value="<?php $eventDate ?>" />
  <p>
    <label>Your Name
      <input type="text" name="attendeeName" id="attendeeName" />
    </label>
  </p>
  <p>
    <label>Your Email Address
      <input type="text" name="attendeeEmail" id="attendeeEmail" />
    </label>
  </p>
  <p>
    <label>Your Phone Number
      <input type="text" name="attendeePhone" id="attendeePhone" />
    </label>
  </p>
  <p> 

  <input type="hidden" name="rsvp" id="1" value="1"/></p>
  <p>
    <input type="submit" name="submit" id="submit" value="RSVP" />
  </p>
</form>
<p>  </p>
<br /><br />
</body>
</html>

 

and here's rsvp2.php, the part that inserts into database and confirms:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Thank you for your RSVP!</title>
</head>

<body>

<?php 

$rsvp = $_REQUEST['rsvp'];

if ($rsvp==1) {

$attendeeName = $_REQUEST['attendeeName'];
$eventTime = $_REQUEST['eventTime'];
$eventDate = $_REQUEST['eventDate'];

$db = mysql_connect("xxx","xxx","xxx") or die("Cannot connect
to server");
mysql_select_db("xxx",$db) or die("Cannot find database");
$sql = mysql_query("INSERT INTO event_rsvp (eventTitle, eventTime, eventDate, attendeeName, attendeeEmail, attendeePhone) VALUES('$eventTitle', '$eventTime', '$eventDate', '$attendeeName', '$attendeeEmail', '$attendeePhone')") or die (mysql_error());

echo "Thank you for your RSVP, $attendeeName.";
echo "<br><br><br>";
echo "Remember this date and time:<br><br>";
echo $eventTime;
echo " on ";
echo $eventDate; 

} else {

echo "Sorry, please go back and try again.";

}

?>

</body>
</html>

 

for some reason, when I check the table in the database, I only get the attendee field information. I don't get the eventTitle, eventTime, and eventDate in the table -- it's just blank. Furthermore, on the confirmation page, only the attendee's name shows up in the echo section. eventDate and eventTime don't appear it looks just like " on ". There has got to be a simple solution to this.

 

Help would be much appreciated.

 

Regards,

Carey

 '=' & echo seems missing...

<input type="hidden" name="eventTitle" id="eventTitle" value="<?php echo $eventTitle ?>" />
     <input type="hidden" name="eventTime" id="eventTime" value="<?php echo $eventTime ?>" />
     <input type="hidden" name="eventDate" id="eventDate" value="<?php echo $eventDate ?>" />

That would totally be it.

 

I tried it with echo first, then took it out to see if it would work and forgot to put it back in.

 

The ='s are totally the problem though. It's been a long day. Thank you very much.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.