2 Replies - 221 Views - Last Post: 13 June 2012 - 08:20 AM Rate Topic: -----

#1 jwag  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 01-April 12

sending php variable through a form submit

Posted 13 June 2012 - 07:28 AM

i have a form inside a while loop, because i need to display every value in an array
so my while loop looks like this
while ($array != 5)
{
echo $value[$array];
$array = $array + 1
}



now i have a form i need to submit and send to a seperate page so now it looks like this
while ($array != 5)
{
echo $value[$array];
echo("
<form action='formProcess.php' method='POST'>
<input type='submit' name='$value[$array]'>
</form>
");
$array = $array + 1;
}


but i need to send that current array value with it. i feel like im being retarted, how would i get the value of the name once im on the other page? like this?
$array = $_POST['submit'];


or
$array = $_POST['$value[$array]'];


would that work, i really don't know.

Is This A Good Question/Topic? 0
  • +

Replies To: sending php variable through a form submit

#2 jwag  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 01-April 12

Re: sending php variable through a form submit

Posted 13 June 2012 - 07:53 AM

View Postjwag, on 13 June 2012 - 07:28 AM, said:

i have a form inside a while loop, because i need to display every value in an array
so my while loop looks like this
while ($array != 5)
{
echo $value[$array];
$array = $array + 1
}

...

nvm i figured it out
on php page
$var= $_POST['var'];
form
<input type='hidden' name='file' value='$value[$array]' />
Was This Post Helpful? 0
  • +
  • -

#3 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2485
  • View blog
  • Posts: 8,524
  • Joined: 08-August 08

Re: sending php variable through a form submit

Posted 13 June 2012 - 08:20 AM

Assuming $array starts at zero your while loop will generate five different forms. Is that what you want?

...also, use an indent style. It will make debugging easier.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1