Jump to content

[SOLVED] Lots of undefined errors


jeff5656

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.