html - Pass values from TWO text boxes in a php file to another php file with a single submit button -
i trying have 2 textboxes, , values entered in them in php file. but, possible have single submit button submits both values ?
to value page1.php page2.php
i have pass value in 1 text box:
<form action='page2.php' method='post'> <input type = "text" name='search' value ="search"> <input type = "submit" name = "submit1" value = "search"> </form> and on page2.php, value using:
$sname = $_post['search']; but, how having 2 text boxes, , passing values of both simultaneously?
<form action='page2.php' method='post'> <input type = "text" name='search1' value ="search1"> <input type = "text" name='search2' value ="search2"> <input type = "submit" name = "submit1" value = "search1","search2"> </form> and on page2.php:
$name1=$_post['search1']; $name2=$_post['search2']; i know not doing right on submit part. changes should right?
your form should this:
<form action='page2.php' method='post'> <input type = "text" name='search1' value ="search1"> <input type = "text" name='search2' value ="search2"> <input type = "submit" name = "submit1" value = "search"> </form> the value submit button not related input box names. similarity of names misguided in first example. in html forms, when user clicks on submit buttons, fields defined in form sent target file specified in action attributed. then, in target file sent variables can retrieved based on method have defined in form.
Comments
Post a Comment