jeff5656 Posted June 10, 2009 Share Posted June 10, 2009 I'm having a brain fart I just cant figure this out. I get these errors: Notice: Undefined index: service in C:\wamp\www\gpu\changestaff-commit.php on line 8 Notice: Undefined index: staff_name in C:\wamp\www\gpu\changestaff-commit.php on line 12 Notice: Undefined index: service in C:\wamp\www\gpu\changestaff-commit.php on line 14 Invalid query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 4 Here is changestaff-commit.php: <?php require('secure.php'); error_reporting (E_ALL); include "connectdb.php"; $service = $_POST['service']; echo $service; $sql = "UPDATE rounder SET staff_name = '" . $_POST['staff_name'] . "' WHERE service = ".$_POST['service'].""; if (isset($sql) && !empty($sql)) { $result = mysql_query($sql) or die ("Invalid query: " . mysql_error()); }?> Here is the form: <form action="changestaff-commit.php"> <select name = "staff_name" > <?php while ($row = mysql_fetch_assoc ($result)) { ?> <option value = "<?php echo $row['staff_name'];?>"><?php echo $row['staff_name'];?></option> <?php } ?> </select> </td> <input type="hidden" name ="service" value="<?php echo $service; ?>"/> <input type="submit" value="Change Staff" /> </form> Link to comment https://forums.phpfreaks.com/topic/161734-solved-lots-of-undefined-errors/ Share on other sites More sharing options...
J.Daniels Posted June 10, 2009 Share Posted June 10, 2009 This: <form action="changestaff-commit.php"> needs to be: <form action="changestaff-commit.php" method="post"> Link to comment https://forums.phpfreaks.com/topic/161734-solved-lots-of-undefined-errors/#findComment-853356 Share on other sites More sharing options...
jeff5656 Posted June 10, 2009 Author Share Posted June 10, 2009 Oh jeez. That really *was* a brain fart. Thanks! Link to comment https://forums.phpfreaks.com/topic/161734-solved-lots-of-undefined-errors/#findComment-853361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.