html - get the value of input element and display it in php page -
i have form
<form method="post" action="file.php"> <input type="button" name="one" value="1"> </input> <input type="button" name="two" value="2"> </input> <input type="submit"> </input> </form>
how can value of input , display value in php page?i tried in way don't work.how can this?
$_post[nameofinput]
you cannot send buttons' values. use radio fields, example:
<input type="radio" name="choice" value="1" /> <input type="radio" name="choice" value="2" />
or can use dropdown too:
<select name="choice"> <option value="1">option 1</option> <option value="2">option 2</option> </select>
then in php:
echo $_post['choice']; // possible results: null/1/2
Comments
Post a Comment