PHP2005 Posted August 12, 2008 Posted August 12, 2008 I need some help to write an if statement. I have 2 checkboxes with same values but different field name I am wonder how do I write a if statement to compare the two checkbox if the value check are the same then I skip to another page otherwise I keep at the same page. Any help will be appreciated.
Quartekoen Posted August 12, 2008 Posted August 12, 2008 Checkbox values are stored as text, so if you're doing a simple check in a script, you could use: If [table::checkbox1 = table::checkbox2] Go to Layout [layoutname] ... Else ... Do this ...
beverly Posted August 13, 2008 Posted August 13, 2008 is this in reference to PHP? is this a FORM and you want to branch based upon field1=field2? if this is a FORM, do you want to branch after submit, or use an AJAX to display different parts of a page based on the match?
PHP2005 Posted August 13, 2008 Author Posted August 13, 2008 yes it is in reference to a php. What am I trying to do is to compare if the the value ckecked on checkbox are the same as the value checked on checkbox 2. If in case they are the same they should go to page1.php, And if in case they are not equal they should go to another page2.php Any help will be appreciated. thank you
beverly Posted August 29, 2008 Posted August 29, 2008 yes it is in reference to a php. What am I trying to do is to compare if the the value ckecked on checkbox are the same as the value checked on checkbox 2. If in case they are the same they should go to page1.php, And if in case they are not equal they should go to another page2.php Any help will be appreciated. thank you Create a third page and have your form submit to IT. Test for equal and branch as needed. Use 'header()' to redirect to the proper page. WARNING: do not introduce any whitespace into the page (that is not inside the "<?php ... ?>"). Or your header() will not work. PHP will think you have pushed the whitespace to the browser and issue a 'header already sent' message (or something like that!)
Recommended Posts
This topic is 5999 days old. Please don't post here. Open a new topic instead.
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