Hi
(In my php form, i'm getting a bunch of data to Mysql, all of which is working correctly except id and name. id and name are fed from Mysql to the form.)
Here's the problem area:
I'm getting an id AND name from a dropdown menu using EXPLODE.
With this code, all columns are fed correctly to Mysql EXCEPT sid and Student:
('$_POST[Teacher]','$_POST[sid]','$_POST[Student]','$_POST[Date]','$_POST[Tardy]','$_POST[Comment]','$_POST[Absent]','$_POST[Inhouse]','$_POST[Suspension]','$_POST[Allpresent]')";
With the code above, this is what's submitted to MYsql:
sid column is blank. Student column has id AND Student with pipe inbetween (ex: 468|Grundy Joe)
When i use this code:
('$_POST[Teacher]','$sid,'$student','$_POST[Date]','$_POST[Tardy]','$_POST[Comment]','$_POST[Absent]','$_POST[Inhouse]','$_POST[Suspension]','$_POST[Allpresent]')";
With the code above, this is what's submitted to MYsql:
sid column and Student columns are blank.
Here is the complete action code:
<html><a href="http://10.49.5.99/">Home </a><br><br>
<BODY BGCOLOR="EED6AF">
</html>
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("DisciplineIncoming", $con);
$part = explode("|", $_POST['student']);
// $part[0] is now client_id// $part[1] is now name
$sid=$part[0];
$student=$part[1];
$sql="INSERT INTO incoming (Teacher, sid, Student, Date, Tardy, Comment, Absent, Inhouse, Suspension, Allpresent)
VALUES
('$_POST[Teacher]','$sid','$tardy','$_POST[Date]','$_POST[Tardy]','$_POST[Comment]','$_POST[Absent]','$_POST[Inhouse]'
,'$_POST[Suspension]','$_POST[Allpresent]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "<h3>Thanks!
<br><br>Your input is now recorded on the master discipline/tardy spreadsheet.
<br><br>Click the Back arrow if you need to input data for another student.
<br><br>If you're finished, you can close this window.";
mysql_close($con)
?>
Can anybody see where i goofed up the code?
Thanks, Mike