Jump to content

[SOLVED] Array Variable in $_POST


aashcool198

Recommended Posts

This code produces a set of radio buttons in each loop..

So each set of radio buttons is named with a value stored in an array.

i.e. $me and each time $me takes value $array[$i].

 

 

 

<form action="<?php echo "insert_skill.php?something=$var"; ?>" method="post">	 
	    



    <?php  
for ($i = 0; $i < $count; $i++){ 
$me = $array_id[$i];
echo $me;
?>
  
  

      <tr>

      <td style = "padding-bottom:20px" ><font face="Arial" size="4"><?php echo $array[$i];?></font></td>

      <td style = "padding-bottom:20px" valign = "middle" align = "center">
  <input type="radio" name = "<?php echo $me; ?>" value="EL"/></td>
  <td style = "padding-bottom:20px" valign = "middle" align = "center">
  <input type="radio" name = "<?php echo $me; ?>" value="IMD"/></td>
  <td style = "padding-bottom:20px" valign = "middle" align = "center">
  <input type="radio" name = "<?php echo $me; ?>" value="EXP"/></td>
  <td style = "padding-bottom:20px" valign = "middle" align = "center">
  <input type="radio" name = "<?php echo $me; ?>" value="NONE"/></td>
  
  </tr>
     
  <?php }?>

  <tr><td colspan=5 style = "padding-bottom:20px" align = "right"><b><font  color="#587050" face="Arial" size="5"><input type="submit" value="save"></font></td></tr>

     </form>

 

 

while submitting the form i am going to another page where i am retrieving the values by this code:

 

$ash = $area[2];


$ashish = $_REQUEST[$ash];

echo $ashish;

 

$area[]  in the second page is same as  $array_id[] in first page. But $ashish is empty that means value is not retrieved i have checked through several echo's everything else is working but as i am using array variables in both the pages the problem is happening.

 

Please help! if you need some more information please let me know.

Link to comment
Share on other sites

what does your $me; echo on the first page?

 

put in the lines

 

print_r($_POST);

exit();

 

in the second page and you will see all the $_POST items in an array and you'll be able to debug from there.

 

also on a side note, you should try and use $_POST and $_GET instead of $_REQUEST... in this case you'll be using $_POST.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.