Pauls74462 Posted December 27, 2008 Share Posted December 27, 2008 I have this code on my page. it will not work. I can replace the " . $_POST['Schools'] " with the schoolid and it will work. $sql = "SELECT lname FROM teachers WHERE schoolid = . $_POST['Schools'] . "; The " . $_POST['Schools'] " comes from a drop down menu. I do get the echo [The school is "Keota" with the ID: "31SIS043"]with this line: echo 'The school is "' . $row['school'] . '" with the ID: "' . $_POST['Schools'] . '"'; which is correct, but will not list the teachers from that school.Paul Link to comment Share on other sites More sharing options...
Synook Posted December 27, 2008 Share Posted December 27, 2008 The ID appears to be a string, so you need to have quotation marks around the posted value (you also forgot closing quotation marks before the concatenation). Don't forget to sanitize the string first, however. $id = mysql_real_escape_string($_POST['Schools']);$sql = "SELECT lname FROM teachers WHERE schoolid = '$id'"; Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.