ilikephp Posted May 19, 2009 Share Posted May 19, 2009 hi, when these fields are checked, I want the submit button to open the response.php page. if it contains errors they will be fixed and if no response.php will open when clicked on it. is it possible to do it? Thanks... I put this code, but it is wrong :S <?php if (!isset($error['name']) && !isset($error['email']) && !isset($error['password']) && !isset($error['accept']) ){ }?> <input name="submit" type="submit" onClick="document.contactForm.action='response.php';" value="Submit"> Quote Link to comment Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 hi, when these fields are checked, I want the submit button to open the response.php page. if it contains errors they will be fixed and if no response.php will open when clicked on it. is it possible to do it? Thanks... I put this code, but it is wrong :S <?php if (!isset($error['name']) && !isset($error['email']) && !isset($error['password']) && !isset($error['accept']) ){ }?> <input name="submit" type="submit" onClick="document.contactForm.action='response.php';" value="Submit"> Huh? Quote Link to comment Share on other sites More sharing options...
waiwai933 Posted May 19, 2009 Share Posted May 19, 2009 Well, it's possible and not possible. First though, your code would better be off with <?php if (!isset($error['name']) && !isset($error['email']) && !isset($error['password']) && !isset($error['accept'])) { echo ("<input name=\"submit\" type=\"submit\" onClick=\"document.contactForm.action='response.php';\" value=\"Submit\">"); } ?> The problem with your existing code was that it didn't pass anything through the brackets, which are the "then" part of "if..then..else". However, if you want it to update every moment, (this script only changes on page refresh, which might still break the script) then you should try Javascript. Quote Link to comment Share on other sites More sharing options...
ilikephp Posted May 19, 2009 Author Share Posted May 19, 2009 thx a lot, I fixed it. but the only problem that I still have is when I enter all the information, the submit button will appear, and the fieds are becoming empty, how can I keep the information inside the fields? Quote Link to comment Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 thanks a lot, I fixed it. but the only problem that I still have is when I enter all the information, the submit button will appear, and the fieds are becoming empty, how can I keep the information inside the fields? <input type="text" name="name_of" value="<?PHP echo htmlspecialchars($_POST['name_of']); ?>"> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 19, 2009 Share Posted May 19, 2009 You can combine this line - if (!isset($error['name']) && !isset($error['email']) && !isset($error['password']) && !isset($error['accept'])) into - if (!isset($error['name'], $error['email'], $error['password'], $error['accept'])) Quote Link to comment Share on other sites More sharing options...
Masna Posted May 19, 2009 Share Posted May 19, 2009 You can combine this line - if (!isset($error['name']) && !isset($error['email']) && !isset($error['password']) && !isset($error['accept'])) into - if (!isset($error['name'], $error['email'], $error['password'], $error['accept'])) What the OP posted and what you have here are, logically, not the same. Passing multiple variables to isset (joined by commas) checks them all with respect to OR; that is, if any one of the 4 variables passed in here isn't set, the entire statement will return true (because of the logical NOT; isset will return false). Quote Link to comment Share on other sites More sharing options...
ilikephp Posted May 19, 2009 Author Share Posted May 19, 2009 THANKS A LOT MAN!!! it works (Y) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.