Timothy:

Your code uses the <?php echo"thisstuff" ?> out of place, try this and 
compare it to what you have:

<?php

if ($id) {
echo "<b>Edit Story:</b><br><br>";

$sql = "  SELECT * FROM story WHERE id='$id'  ";
result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
$id = $myrow['id'];
$title = $myrow['title'];
$body = $myrow['body'];


$myvar = "<input type=\"hidden\" name=\"id\" value=\"$id\">";
?>


<form method="post" action="name_of_current_script">
<?php echo"$myvar"; ?>
</form>

If you only have a single result for $id the above code will be fine. 
If you know there may be more than one then you'll have to tuse a loop:

while($myrow = mysql_fetch_array($result)) {
$myrow = mysql_fetch_array($result);
$id = $myrow['id'];
$title = $myrow['title'];
$body = $myrow['body'];

$myvar = $myvar . "<input type=\"hidden\" name=\"id\" value=\"$id\">";
}

<?php echo"$myvar"; ?>


HTH ;-)  Russ



#-------------------------------------------------------#
                                
         "Believe nothing - consider everything"        
                                                        
  Russ Michell
  Anglia Polytechnic University Webteam
  http://gertrude.sipu.anglia.ac.uk/webteam
  [EMAIL PROTECTED]
  +44 (0)1223 363271 ext 2331
  
  www.theruss.com
                        
#-------------------------------------------------------#


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to