Form Problem in Loop

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NotOnUrNelly
Forum Commoner
Posts: 61
Joined: Wed Mar 24, 2004 4:45 pm

Form Problem in Loop

Post by NotOnUrNelly »

Hi All,

I am trying to create a basic image manager backend to update images on my main webpages. Here is a basic screen shot of my page

http://www.runthelakes.co.uk/wain/image ... summit=112

I cannot understand why I have an empty image before the database content is displayed.

Is there something wrong with my do while loop

Code: Select all

 
 
  do { ?>
 
  <form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr> 
        <td width="300"> 
          <input name="summitno" type="hidden" id="runnerid" value="<?php echo $result_pos['id']; ?>"> 
          <?php   $ImagePath = "/wain/images/fells/uploads/MainPicture/";
        $ImageNo = $result_pos['id'].".jpg";
        
        //echo $ImageNo;??></td>
        <td width = "80"> </td>
          <td><?php  echo '<img src="'.$ImagePath."di_".$ImageNo.'" border=0 height="130" width="180">';?></td>
        <td width="80"><input name="toppy" type="text" id="position" value="<?php echo $result_pos['comment']; ?>" size="30" maxlength="30"> </td>
    <td width="32"><input name="lefty" type="text" id="racetime" value="<?php  echo $result_pos['id']; ?>" size="3" maxlength="3"> </td>
     <td width="32"><input type="submit" name="Submit" value="Update"></td>
      <td></td>  <input type="hidden" name="MM_update" value="form1"></td>
          </form>
<?php  } while ($result_pos = mysql_fetch_assoc($result)); ?>
 
 
Many Thanks
Jamie
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Form Problem in Loop

Post by Christopher »

Use a while statement instead of a do/while.
(#10850)
Post Reply