I'm really new at using PHP, and I'm not really sure what kind of solution I need to be looking for, but anyway... I have created a mini-form, that only has one question. I have used a select-tag and seven option-tags. I want to save the answer from the user as a variable, that I can then use in an if-statement later, on the same page as the form was on. Is this even possible? And newbie-friendly?
2条回答 默认 最新
ds0802 2015-05-24 23:04关注Yes, it is possible. 1. Check that you have added method in
formtag (action means that you will be using same page for your if-statement) and that you have name forselectelement:<form action="?" method="get"> <select name="question"> <option value="1">one</option> <option value="2">two</option> ... <option value="7">seven</option> </select>- Then, after form submit the page will be reloaded and you will get selected value from
$_GET["question"]variable.
Read more about it: PHP $_GET
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报- Then, after form submit the page will be reloaded and you will get selected value from