Forum Moderators: coopster

Message Too Old, No Replies

Passing form element values to another form in the same page

         

kvndeepak

7:15 pm on Jun 2, 2004 (gmt 0)



Hello all
This is my first post. I am relatively new to PHP - had been programming in Perl though. I am facing the following problem:

<background details>
I have a php page which has a select list - populated from a Mysql table.

The user selects one of the entries from the list and clicks "Submit".

The php displays the contents of the table corresponding to the chosen entry.
</background details>

One of the fields of this table is set editable, so the user can change its values. After changing, he needs to submit this back again (second submit button) in the same page. How must I capture the "edited" data from the first form and populate my table in the second submit's click event?

Thanks a lot!.
Regards,
Deepak

WhosAWhata

9:39 pm on Jun 2, 2004 (gmt 0)

10+ Year Member



<?
if(count($_POST)){
$form = "";
foreach($_POST as $k => $v) {
$form .= "<input type=\"hidden\" name=\"".$k."\" value=\"".$v."\">";
}
}
?>
<form blah blah blah>
<?=$form?>
<!--other form stuff-->
</form>

WhosAWhata

9:40 pm on Jun 2, 2004 (gmt 0)

10+ Year Member



BTW that captures all vars sent via the <form action="post"> method and sets a hidden input field for them