dolcezza Posted January 7, 2008 Share Posted January 7, 2008 I have a form, all the variables that are pulled into the form are showing up fine. But when you hit "submit, the next page shows nothing. If I try to echo $id or $adress etc... I get nothing. Any help is appreciated. Form code: <form action="submiteventform.php" method="POST"> <input type="hidden" name="eventid" id="eventid" value="<? echo $eventid; ?>"> Date Of Event: <? echo $friendly_date; ?><br /> Place: <? echo $venueinfo['venue']; ?><br /> Author: <? echo $authorname; ?> <br /> Location: <input type="text" name="address" id="address" value="<? echo $venueinfo['address']; ?>"> <br /> <? echo $venueinfo['city']; ?>, <? echo $venueinfo['state']; ?> <? echo $venueinfo['zip']; ?><br /> Directions: <textarea type="text" rows="8" cols="20" name="directions" id="directions" value="<? echo $venueinfo['directions']; ?>"></textarea><br /> Schedule:<br /> Please schedule no more than three assemblies of 45 minutes each, leaving 5-10 minutes in between.<br /> <? $schedulequery = ("SELECT * FROM `schedules` WHERE eventid = '$eventid'"); $scheduleresult=mysql_query($schedulequery); for ($loop=1;$loop<=3;$loop++) { if ($scheduleinfo=mysql_fetch_array($scheduleresult)) { $time=$scheduleinfo[3]; } else { $time=""; } ?> Time:<input type="text" size="8" name="time-<? echo $loop; ?>" id="time" value="<? echo $scheduleinfo['time']; ?>"> Grades:<input type="text" size="8" name="grades-<? echo $loop; ?>" id="grades" value="<? echo $scheduleinfo['grades']; ?>"> Room:<input type="text" size="8" name="room-<? echo $loop; ?>" id="room" value="<? echo $scheduleinfo['room']; ?>"> Notes:<input type="text" name="notes" id="notes-<? echo $loop; ?>" value="<? echo $scheduleinfo['notes']; ?>"><br /> <? } ?> Contact: <? echo $venueinfo['$name']; ?><br /> Phone:<input type="text" size="15" name="phone" id="phone" value="<? echo $venueinfo['phone']; ?>"><br /> Email:<input type="text" size="25" name="email" id="email" value="<? echo $venueinfo['email']; ?>"> Event Notes: <input type="text" size="200" name="eventnotes" id="eventnotes"> <input type="submit" value="Submit"> </form> submit code: <?php include_once("connect.php"); $eventid = $_POST['eventid']; $address = $_POST['address']; $city = $_POST['city']; $state = $_POST['state']; $zip = $_POST['zip']; $directions = $_POST['directions']; $eventnotes = $_POST['eventnotes']; $query = "UPDATE events SET address='$address', city='$city', state='$state', zip='$zip', directions='$directions', other='$eventnotes' WHERE eventid = '$eventid'"; $result = mysql_query($query); ?> Quote Link to comment https://forums.phpfreaks.com/topic/84809-solved-form-variables-not-working/ Share on other sites More sharing options...
redarrow Posted January 7, 2008 Share Posted January 7, 2008 <?php include_once("connect.php"); $eventid = mysql_real_escape_string($_POST['eventid']); $address = mysql_real_escape_string($_POST['address']); $city = mysql_real_escape_string($_POST['city']); $state = mysql_real_escape_string($_POST['state']); $zip = mysql_real_escape_string($_POST['zip']); $directions = mysql_real_escape_string($_POST['directions']); $eventnotes = mysql_real_escape_string($_POST['eventnotes']); if($_POST['submit']){ $query = "UPDATE events SET address='$address', city='$city', state='$state', zip='$zip', directions='$directions', other='$eventnotes' WHERE eventid = '$eventid'"; $result = mysql_query($query)or die(mysql_error()); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/84809-solved-form-variables-not-working/#findComment-432345 Share on other sites More sharing options...
redarrow Posted January 7, 2008 Share Posted January 7, 2008 try both here and below together m8......... <form action="submiteventform.php" method="POST"> <input type="hidden" name="eventid" id="eventid" value="<? echo $eventid; ?>"> Date Of Event: <? echo $friendly_date; ?><br /> Place: <? echo $venueinfo['venue']; ?><br /> Author: <? echo $authorname; ?> <br /> Location: <input type="text" name="address" id="address" value="<? echo $venueinfo['address']; ?>"> <br /> <? echo $venueinfo['city']; ?>, <? echo $venueinfo['state']; ?> <? echo $venueinfo['zip']; ?><br /> Directions: <textarea type="text" rows="8" cols="20" name="directions" id="directions" value="<? echo $venueinfo['directions']; ?>"></textarea><br /> Schedule:<br /> Please schedule no more than three assemblies of 45 minutes each, leaving 5-10 minutes in between.<br /> <? $schedulequery = ("SELECT * FROM `schedules` WHERE eventid = '$eventid'"); $scheduleresult=mysql_query($schedulequery); for ($loop=1;$loop<=3;$loop++) { if ($scheduleinfo=mysql_fetch_array($scheduleresult)) { $time=$scheduleinfo[3]; } else { $time=""; } ?> Time:<input type="text" size="8" name="time-<? echo $loop; ?>" id="time" value="<? echo $scheduleinfo['time']; ?>"> Grades:<input type="text" size="8" name="grades-<? echo $loop; ?>" id="grades" value="<? echo $scheduleinfo['grades']; ?>"> Room:<input type="text" size="8" name="room-<? echo $loop; ?>" id="room" value="<? echo $scheduleinfo['room']; ?>"> Notes:<input type="text" name="notes" id="notes-<? echo $loop; ?>" value="<? echo $scheduleinfo['notes']; ?>"><br /> <? } ?> Contact: <? echo $venueinfo['$name']; ?><br /> Phone:<input type="text" size="15" name="phone" id="phone" value="<? echo $venueinfo['phone']; ?>"><br /> Email:<input type="text" size="25" name="email" id="email" value="<? echo $venueinfo['email']; ?>"> Event Notes: <input type="text" size="200" name="eventnotes" id="eventnotes"> <input name="submit" type="submit" value="Submit"> </form> Quote Link to comment https://forums.phpfreaks.com/topic/84809-solved-form-variables-not-working/#findComment-432352 Share on other sites More sharing options...
dolcezza Posted January 7, 2008 Author Share Posted January 7, 2008 Thank you... worked great. Can you possibly tell me what is wrong with the second half? It says there is a parse error on 23 line 23 is if ($time) { ... <?php include_once("connect.php"); $eventid = mysql_real_escape_string($_POST['eventid']); $address = mysql_real_escape_string($_POST['address']); $city = mysql_real_escape_string($_POST['city']); $state = mysql_real_escape_string($_POST['state']); $zip = mysql_real_escape_string($_POST['zip']); $directions = mysql_real_escape_string($_POST['directions']); $eventnotes = mysql_real_escape_string($_POST['eventnotes']); if($_POST['submit']){ $query = "UPDATE events SET address='$address', city='$city', state='$state', zip='$zip', directions='$directions', other='$eventnotes' WHERE eventid = '$eventid'"; $result = mysql_query($query)or die(mysql_error()); } // insert schedule $schedulequery = ("SELECT * FROM `schedule` WHERE eventid = '$eventid'); $scheduleresult=mysql_query($schedulequery); for ($i = 1; $i <= 3; $i++) { $time = $_POST['time-' . $i]; $grades = $_POST['grades-' . $i]; $room = $_POST['room-' . $i]; $notes = $_POST['notes-' . $i]; if ($time) { $scheduleinsert = "INSERT INTO schedules (eventid, time, grades, room, notes) VALUES ('$eventid', '$time', '$grades', '$room', '$notes')"; $schedule_result=mysql_query($scheduleinsert); echo $time; } } ?> Thank You so much! Quote Link to comment https://forums.phpfreaks.com/topic/84809-solved-form-variables-not-working/#findComment-432360 Share on other sites More sharing options...
rajivgonsalves Posted January 7, 2008 Share Posted January 7, 2008 this // insert schedule $schedulequery = ("SELECT * FROM `schedule` WHERE eventid = '$eventid'); should be // insert schedule $schedulequery = ("SELECT * FROM `schedule` WHERE eventid = '$eventid'"); you forgot the quote Quote Link to comment https://forums.phpfreaks.com/topic/84809-solved-form-variables-not-working/#findComment-432363 Share on other sites More sharing options...
dolcezza Posted January 7, 2008 Author Share Posted January 7, 2008 I can't thank you enough... I posted that part last night and nobody including myself caught it. Greatly appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/84809-solved-form-variables-not-working/#findComment-432364 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.