Monday, September 3, 2018

php - On submit, echo 'selected' on the right option of a select tag if form return false



I got an issue right now, and I really don't understand why, lol. Let me explain it!



What I want to do : If form has been submitted and return false, take "correct" values within the form and place it into his right input value so that the customer won't fill it again. (In this situation, it's about a select tag with many options)



What it's doing : Well, when I click on submit, my option selected it's ALWAYS the value 3 (5 ans et plus) but when I try to echo out $_POST['depuis'], it is the right value that echos out.




Here's my partial script :











Answer



Replace



if(isset($_POST['depuis']) == '0')



with



if(isset($_POST['depuis']) &&  $_POST['depuis'] == '0')


and so on...


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...