jimfog Posted February 12, 2013 Share Posted February 12, 2013 I have a logic error in my code and I am having difficulty finding it.It has to do with two If statements, one inside another: if(isset($_GET['enduser'])==true) {?><div id="enduserform"> <form action="register_form.php" method="post"> <label class="label" for="username/e-mail">*</label><input name="username/e-mail" placeholder="Username/e-mail" type="text" size="40" /><br> <label class="label" for="password">*</label><input name="password" placeholder="Κωδικός" type="text" size="40" /><br> <label class="label" for="password2">*</label><input name="password2" placeholder="Ξαναγράψε τον κωδικό...για την δική σου ασφάλεια" type="text" size="40" /><br> <p class="info">Να είναι πάνω από 6 χαρακτήρες</p> <input name="submitenduser" type="submit" /> <p class="required">Όλα τα πεδία απαιτούνται</p> <p> το παραπάνω μήνυμα πρέπει να το φτιάξω να φαίνεται μόνο όταν ο χρήστης πατά το sumbit button, όπως στο facebook δηλαδή</p> </form> </div> <?php } if(isset($_GET['enduser'])==true) {?><div id="enduserform"> <form action="register_form.php" method="post"> <label class="label" for="username/e-mail">*</label><input name="username/e-mail" placeholder="Username/e-mail" type="text" size="40" /><br> <label class="label" for="password">*</label><input name="password" placeholder="Κωδικός" type="text" size="40" /><br> <label class="label" for="password2">*</label><input name="password2" placeholder="Ξαναγράψε τον κωδικό...για την δική σου ασφάλεια" type="text" size="40" /><br> <p class="info">Να είναι πάνω από 6 χαρακτήρες</p> <input name="submitenduser" type="submit" /> <p class="required">Όλα τα πεδία απαιτούνται</p> <p> το παραπάνω μήνυμα πρέπει να το φτιάξω να φαίνεται μόνο όταν ο χρήστης πατά το sumbit button, όπως στο facebook δηλαδή</p> </form> </div> <?php } if (isset($_GET['bizuser'])==true) {?> <a href="http://localhost/Appointments/Frontend/register_form.php?hairstyle">hairstyle<a/><br> if(isset($_GET['hairstyle'])) { echo 'hi';?> <div id="bizuserform"> <form ... </form> </div><?php } } ?> The problem is that the inner IF does not work-I expect that when that user clicks the hairstyle link seen above a form will appear( <div id="bizuserform"><form ... </form>). I have not included the form code because it is big and because I do not think it is needed.besides, I tried echoing a statement above and it still not works. Of course if the inner if statement is as a standalone statement(not inner) it will work-otherwise it will not. Link to comment Share on other sites More sharing options...
dsonesuk Posted February 12, 2013 Share Posted February 12, 2013 (edited) if (isset($_GET['bizuser'])==true) {?> <a href="http://localhost/Appointments/Frontend/register_form.php?hairstyle">hairstyle<a/><br> <?php if(isset($_GET['hairstyle'])) { echo 'hi';?> <div id="bizuserform"> <form ... </form> </div><?php } } ?> the php is still being seen as part of html. as thers no php start tag to go with closing tag after echo 'hi'; Edited February 12, 2013 by dsonesuk Link to comment Share on other sites More sharing options...
jimfog Posted February 13, 2013 Author Share Posted February 13, 2013 No it does not work-I am showing the code once more(part of it)-the code you suggested and I am doing it to be sure that this is what you gave me.: if (isset($_GET['bizuser'])==true) {?> <a href="http://localhost/Appointments/Frontend/register_form.php?hairstyle">κομμωτήρια<a/><br> <a href="http://localhost/Appointments/Frontend/register_form.php?medical">ιατρικες υπηρεσίες</a><br> <a href="http://localhost/Appointments/Frontend/register_form.php?petgrooming">pet grooming</a><br> <a href="http://localhost/Appointments/Frontend/register_form.php?salonspa">salon spa</a> <?php if(isset($_GET['hairstyle'])) {echo 'hi'; ?> Is this the code you gave me? Link to comment Share on other sites More sharing options...
dsonesuk Posted February 13, 2013 Share Posted February 13, 2013 yes, that what i meant Is the value passed with $_GET['bizuser'] you are trying to check is true, or is it if the isset($_GET['bizuser']) is true? isset($_GET['bizuser']) will return true if a value has been sent on its own, if you wish to check that a value has been sent AND that value is true use. if(isset($_GET['bizuser']) && $_GET['bizuser']==true) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now