SkyRanger Posted April 13, 2007 Share Posted April 13, 2007 I am having a submitting problem, Not exactly sure what the problem is. Or if I am even doing it right. The delete function of the script works no problem. Just can't get the submit part to work. ##---Start of Add Event---## <table width="400" border="0" align="center"> <tr><form name="form" method="post" action="calendaradmin.php"> <td>Date: <select name="eventyr" size="1" id="eventyr"> <option value="2007">2007</option> <option value="2008">2008</option> </select> <select name="eventmth" size="1" id="eventmth"> <option value="01">January</option> <option value="02">February</option> <option value="etc">etc</option> </select> <select name="eventmth" size="1" id="eventmth"> <option value="01">01</option> <option value="02">02</option> <option value="03">03</option> <option value="etc">etc</option> </select> </td> </tr> <tr> <td>Event Title: <input name="eventtitle" type="text" id="eventtitle" size="50"></td> </tr> <tr> <td><textarea name="eventmsg" cols="62" rows="5">Description of event</textarea></td> </tr> <tr> <td><div align="center"><input name="submit" type="submit" id="submit" value="Add Event"></div></td> </tr></form> </table> ##---End of Post Event---## ##---Start of Events Listed ---## <p><h1 align="center">All Events</h1> <? $sql = "SELECT * FROM calendar_events"; $result = mysql_query($sql); $count = mysql_num_rows($result); ?> <table width="400" border="0" align="center"> <?php while ($e = mysql_fetch_array($result)) { ?> <tr><form name="form1" method="post" action="calendaradmin.php"> <td width="300">Date: <?php echo $e[event_date]; ?></td> <td width=\"90\"><a href="editevent.php?event_id=<?php echo $e[event_id]; ?>">Edit</a> | Delete: <input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php echo $e[event_id]; ?>"></td> </tr> <tr> <td colspan="2">Event Title: <?php echo $e[event_title]; ?></td> </tr> <tr> <td colspan="2"><?php echo $e[event_desc]; ?></td> </tr> <tr> <td colspan="2"><hr /></td> </tr> <? } ?> <tr> <td colspan="2" align="center"><input name="delete" type="submit" id="delete" value="Delete"></td> </tr></form> </table> <? ###----End of List Events----### if($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "DELETE FROM calendar_events WHERE event_id='$del_id'"; $result = mysql_query($sql); } if($submit){ $sql1 = "insert into calendar_events values ('','$eventyr-$eventmth-$eventday','$eventtitle','$eventmsg')"; $result = mysql_query($sql1); echo "Thank you! Event entered.\n"; } if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=calendaradmin.php\">"; } } Link to comment https://forums.phpfreaks.com/topic/46913-solved-submitting-problem/ Share on other sites More sharing options...
pocobueno1388 Posted April 13, 2007 Share Posted April 13, 2007 You need to put: if ($_POST['submit']){ Link to comment https://forums.phpfreaks.com/topic/46913-solved-submitting-problem/#findComment-228740 Share on other sites More sharing options...
SkyRanger Posted April 13, 2007 Author Share Posted April 13, 2007 Ok, I changed this: if($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "DELETE FROM calendar_events WHERE event_id='$del_id'"; $result = mysql_query($sql); } if($submit){ $sql1 = "insert into calendar_events values ('','$eventyr-$eventmth-$eventday','$eventtitle','$eventmsg')"; $result = mysql_query($sql1); echo "Thank you! Event entered.\n"; } if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=calendaradmin.php\">"; } } to if($delete){ for($i=0;$i<$count;$i++){ $del_id = $checkbox[$i]; $sql = "DELETE FROM calendar_events WHERE event_id='$del_id'"; $result = mysql_query($sql); } if ($_POST['submit']){ $sql1 = "insert into calendar_events values ('','$eventyr-$eventmth-$event-day','$eventtitle','$eventmsg')"; $result = mysql_query($sql1); echo "Thank you! Event entered.\n"; } if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=calendaradmin.php\">"; } } And it still is not posting. Am I forgetting to put something in the: if ($_POST['submit']){ $sql1 = "insert into calendar_events values ('','$eventyr-$eventmth-$event-day','$eventtitle','$eventmsg')"; $result = mysql_query($sql1); echo "Thank you! Event entered.\n"; } Do I need to put: $_post['$eventyr']; or something along that line? Link to comment https://forums.phpfreaks.com/topic/46913-solved-submitting-problem/#findComment-228749 Share on other sites More sharing options...
yzerman Posted April 13, 2007 Share Posted April 13, 2007 Your insert query is messed up. Try $sqll = INSERT into calendar_events (id, date, title, msg) VALUES ('','$eventyr-$eventmth-$eventday','$eventtitle','$eventmsg')"; Link to comment https://forums.phpfreaks.com/topic/46913-solved-submitting-problem/#findComment-228757 Share on other sites More sharing options...
SkyRanger Posted April 13, 2007 Author Share Posted April 13, 2007 No, that didn't work either, seems that when I hit Add Event it doesn't seem to be going to the: if($submit){ $sql1 = INSERT into calendar_events (id, date, title, msg) VALUES ('','$eventyr-$eventmth-$eventday','$eventtitle','$eventmsg')"; $result = mysql_query($sql1); echo "Thank you! Event entered.\n"; } Link to comment https://forums.phpfreaks.com/topic/46913-solved-submitting-problem/#findComment-228767 Share on other sites More sharing options...
SkyRanger Posted April 14, 2007 Author Share Posted April 14, 2007 bump Link to comment https://forums.phpfreaks.com/topic/46913-solved-submitting-problem/#findComment-228932 Share on other sites More sharing options...
SkyRanger Posted April 14, 2007 Author Share Posted April 14, 2007 Was taking to long to figure out, so I went with an outside page till I release the next version of my script. Thanks for the help all. Link to comment https://forums.phpfreaks.com/topic/46913-solved-submitting-problem/#findComment-228949 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.