Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
86
rated 0 times [  87] [ 1]  / answers: 1 / hits: 34615  / 13 Years ago, sun, january 29, 2012, 12:00:00
<form action=here.php method=POST>
<input type=text name=text>

<div id=one>
<input type=hidden name=aaa value=one>
<input type=submit value=Send>
</div>

<div id=two>
<input type=hidden name=aaa value=two>
<input type=submit value=Send>
</div>

</form>


Now if i click on Send of div ONE or div TWO i have always in $_POST['aaa'] = 'two';



Is possible make one form with two submit with different values?



If i click on div one submit i would like reveice $_POST['aaa'] = 'one' and if i click on div two submit i would like receive $_POST['aaa'] = 'two'.



How can i make it?



I can use for this PHP and jQuery.



EDIT:
I dont want create two form - i dont want showing two many times <input type=text name=text>



EDIT: maybe i can instead button submit ? but how?


More From » php

 Answers
15

It seems that what you actually want to do is have a value in each of the buttons, see this, for example:



<form action=demo_form.asp method=get>
Choose your favorite subject:
<button name=subject type=submit value=fav_HTML>HTML</button>
<button name=subject type=submit value=fav_CSS>CSS</button>
</form>

[#87746] Friday, January 27, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
megb

Total Points: 230
Total Questions: 113
Total Answers: 100

Location: Tokelau
Member since Sun, May 7, 2023
1 Year ago
;