Dead Form Buttons - why? The code says it's impossible

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
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Dead Form Buttons - why? The code says it's impossible

Post by simonmlewis »

Here is a weird one.
I have a PHP page with three <form> tags.

Sometimes they all work, sometimes they don't.

The three FORMS do this.

In order as they appear in the code:
1: displays a picture, with a form tag to delete the photo.
...or, if there is no photo, it displays the code to ADD a photo.
2: does the same as above, except it does it in a $token $String STR type code that displays all pictures in the sql field to show all photos in the gallery.
3. a basic form full of various field types to update a a product set of details.

The problem is this:
3. works fine.

2. the Delete sometimes does not work. If there are 3-5 photos, the second one down's "Delete Photo" button appears, but is 'dead'. It's not disabled, it just won't click or press in.

1. generally works fine, but even that one now has the 'dead' issue.

Has anyone ever come across this?

Here is the code from the two problem Forms.

Code: Select all

$result = mysql_query ("SELECT * FROM 6_products WHERE id = '$id'");
 
while ($row = mysql_fetch_object($result))
      {
            echo "
            <div class='header' style='color:#000000'>$row->title</div>
            <div class='editphotosbox'>
            <div style='background-color:#000000; color: #ffffff; padding-bottom:5px;'>
PRIMARY PHOTO<br/>
";
 
if ($row->photoprimary <> NULL) { echo "
<a href='images/productphotos/$row->photoprimary' rel='lightbox[$row->id]' /><img src='images/productphotos/$row->photoprimary' border='0' border='0' width='90px' /></a>
     <form method='post' action='index.php?page=a_productdelphoprim&menu=a_products'>
<input type='hidden' name='id' value='$row->id'>
<input type='hidden' name='photoprimary' value='$row->photoprimary'>
<input type='submit' value='Delete Primary Photo' style='font-family:arial, verdana; font-size:11.2px'>
</form>";}
elseif ($row->photoprimary == NULL)
{ echo "<form action='index.php?page=a_productaddphoprim&menu=a_products' method='POST' name='photoprimary' enctype='multipart/form-data'><input type='hidden' name='id' value='$row->id'><input name='photoprimary' type='file' /><input type='submit' value='Upload Browsed File'></form>";}
 
echo "</div>
<div class='admingalleryheader'>GALLERY PHOTOS
            <form action='index.php?page=a_productaddpho&menu=a_products' method='POST' name='photo' enctype='multipart/form-data'><input type='hidden' name='id' value='$row->id'><input name='photo' type='file' /><input type='submit' value='Upload Browsed File'></form></div>";
            
            $string = "$row->photo";
      $token = strtok($string,"|");
      while($token) {
      echo "<hr noshade size='1' color='#e3e3e3'>
     <form method='post' action='index.php?page=a_productdelpho&menu=a_products'>
<input type='hidden' name='id' value='$row->id'>
<input type='hidden' name='photodelete' value='$token'>
<input type='submit' value='Delete Photo Below' style='font-family:arial, verdana; font-size:11.2px'>
</form>
      <a href='images/productphotos/$token' rel='lightbox[$row->id]' /><img   src='images/productphotos/$token' border='0' border='0' width='90px' /></a><br/>
  
";
$token = strtok("|");
}
            
            echo "
            </div>
NEW ENTRY TO THIS PROBLEM: IT'S A FIREFOX ONLY PROBLEM.
IE7 IS FINE.

Simon
Last edited by Benjamin on Thu May 21, 2009 8:40 am, edited 1 time in total.
Reason: Changed code type from text to php.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply