Jump to content

How Get Varible A Value From Input Form


jawad hamzah

Recommended Posts

i have form like this <form action='page1.php' method='post'> <input type='text' id='mytext'> <a href='page2.php?var1=hello&var2=(here i want to but input text value ... How?)'>Go To Page2</a></form>I want when i click Go To Page2 open page2.php and print this :var2 : value of mytextfor example if i type in input text this word (Jawad) and click Go To Page then open page2.php and type in it :Hello : JawadMy qession : How i ger the variable (var2) the value of (mytext) in same form Notic : I know to do this by submit button but i want to make it by variabels .Thanks

Link to comment
Share on other sites

you have to give a name to the input field, like

  <input type='text' name='mytext'>

then get the value from $_POST['mytext']also you have to add a input submit, clicking the link won't submit the form

Link to comment
Share on other sites

above i learn how i but text value in my varible by this code

<a href='page2.php?var1=hello&var2=' onclick="this.href+=document.getElementById('mytext').value">Go To Page2</a>
but i tray to put many values from my form's input but ???then i want like this :If i have three textbox in my form and i want to show it's value in three varible like this :<form action='page1.php' method='post'><input type='text' id='mytext1'><input type='text' id='mytext2'><input type='text' id='mytext3'><a href='page2.php?var1=(value of text1)&var2=(value of text2)&var3=(value of text3)'>Go To Page2</a></form>How i make it please ??
Link to comment
Share on other sites

Use a submit button instead of a link. You can format the button to make it look like a link, but just use a regular submit button. This is exactly what forms and submit buttons are for, there's no reason to try and reinvent the wheel.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...