Hi there,
this is the issue...
I am learning how to make a table management interface in php. I am able thus far to add a record but when I try to go and modify a record, by clicking on an id key-ed person from a drop down, my script breaks.
what I get in the url is this:
//http://isadore.local/~miriam/php/tutorial_book/show_modcontact.php?id=2&submit=Select+this+artist+//
and nothing in the browser. Before I had error_reporting set to all, and i would get a message saying my index was undefined? now I turned that off and instead I get nothing..
heres the drop down:
---- start :
<p>Select a artist from the list below,to modify the artist's record.</p>
<form METHOD="POST " ACTION="show_modcontact.php">
<strong>artists:</strong>
<select name="id">
<option value="2">2,baker,william</option><option value="4">4,nurse,lauren</option><option value="3">3,robson,jerry</option><option value="5">5,schwartz,ned</option><option value="1">1,verburg,miriam</option>
</select>
<input TYPE="SUBMIT" NAME="submit" VALUE="Select this artist "></form>
--- end :
heres the code that is supposed to make it work;
-- start
while ($row =mysql_fetch_array($result)){
$id = $row['id'];
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$option_block .="<option value=\"$id\">$id,$last_name,$first_name</option>";
}
//create the entire form block
$display_block ="
<FORM METHOD=\"POST \" ACTION=\"show_modcontact.php\">
<strong>artists:</strong>
<select name=\"id\">
$option_block
</select>
<INPUT TYPE=\"SUBMIT\" NAME=\"submit\" VALUE=\"Select this artist \"></form>";
---end
heres is the code that calls the id in the next page;
---start
$sql ="SELECT id, first_name, last_name, city, email, web, image, statement FROM $table_name WHERE id ='$_POST[id]'";
$result =@($sql,$connection)or die(mysql_error());
//get results for display
while ($row =mysql_fetch_array($result)){
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$city = $row['city'];
$email = $row['email'];
$web = $row['web'];
$image = $row['image'];
$statement = $row['statement'];
}
?>
--end
Should I be putting $POST_['id'] somewhere at the top? maybe it's a sessions problem?
I have globals set to off. so if it isn't tracking my sessions, will it not remember variables apssed via a form?
aaargghhh..
unless it has something to do with how I have set the id in mysql..
"
id int(11) unsigned NOT NULL auto_increment,
KEY id (id)
"
I also indexed the id just to be on the safe side????
help? ?
mir