表单处理不会传递价值

i have this code which permits me to do a request in order to make a query!

Now the form which is processed has this code:

<form action="edit_images.php" method="post">
<input type="hidden" value="<? echo $gal_id1 ?>" name="img_id1"  />
<input type="submit" value="Edit All Images"  />
</form>

While the query is like this :

$img_id=$_REQUEST['img_id1'];
$sql="SELECT * FROM tbl_images WHERE Img_gal_id='$img_id'";

But it seems like it won't take the value... I mean, it doesn't recognize the $img_id, which i have printed before and takes the exact value.

Let me show you the query i use in order to retrieve it:

$sql = "SELECT gal_id,gal_title,gal_image FROM tbl_galleries where gal_id='" . $_REQUEST['gid'] ."';";
      $query = mysql_query($sql) or $myErrorsP = mysql_error();
      if(isset($myErrors) && $myErrorsP!=''){     
      } else {          
          $row = mysql_fetch_row($query);
          mysql_free_result($query);
          $gal_id    = $row[0];
          $gal_id1    = $row[0];
          $gal_title = $row[1];
          $gal_image = $row[2];                     
      } 

You are missing a ; on the end of your echo that isn't outputting the value as expected. Additionally, you are using short tags, which could be causing problems. You might want to swtich to using <?php as an opening over <? on it's own.

<input type="hidden" value="<?php echo $gal_id1; ?>" name="img_id1"  />

Lastly, you are using zero protection against injection attacks. Please, research prepared statements in PDO and update your code. The first injection attack you don't have will thank you for it.

Edit: When you run into a problem like this, it is often good practice to echo out the $sql just before you execute it.

you could do this in the future with:

$sql = "SELECT gal_id,gal_title,gal_image FROM tbl_galleries where gal_id='" . $_REQUEST['gid'] ."';";
echo $sql."<br>
";
$query = mysql_query($sql) or $myErrorsP = mysql_error();

which would have probably given you an excellent indication of what the problem was.