Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I pass a parameter with submit button on form

Tags:

html

forms

php

I want to create the from that can change product data in mySQL made by PHP.
and I have the key column that auto increment and specify each product. When i click to edit product link .it will pass the key values that i get from each product and link to editPage.php

$Key = $data['Key']; 
<a href=\"editPage.php?Key=".$Key."\">edit</a>

in editPage.php i get the key values from previous page and i want pass thisvalues to next page with submit form button.I attach Key values in action link.

<?$Key = $_GET["Key"];?>
<form id="form2" name="form1" method="post" action="editWeb.php?Key=".$Key." \">

It don't work, Can I pass Key values with another ways. Tell me if you want more information Thanks!!:))

like image 473
DrNutsu Avatar asked Nov 21 '12 11:11

DrNutsu


1 Answers

You need to echo the value.

<form id="form2" name="form1" method="post" action="editWeb.php?Key=<? echo $Key ?>"/>

You could also use a hidden input:

<form id="form2" name="form1" method="post" action="editWeb.php"/>
<input type="hidden" name="Key" value="<? echo $Key ?>" />
like image 153
xdazz Avatar answered Sep 18 '22 18:09

xdazz