kannu Posted November 17, 2008 Share Posted November 17, 2008 hello, I have a php, html page. I plan to use two radio buttons echo" <input type='radio' name='payment_type' value='complete' checked> Complete <input type='radio' name='payment_type' value='incom'>incom "; I have a question: Before the user exists this page, I want to check the value of the radio button and store it in the variable $selt Can you please tell me how can I do the same. sorry I am very novice in php thanks Quote Link to comment Share on other sites More sharing options...
laPistola Posted November 17, 2008 Share Posted November 17, 2008 as soon as you exit the page any vars will be lost, i think what your aiming for is to pass the status of the radio buttons over to another page is that right?? Quote Link to comment Share on other sites More sharing options...
kannu Posted November 17, 2008 Author Share Posted November 17, 2008 hello thanks for the reply. yes, i would have to pass the status of the radio button to another page also. but before i do that, i would want to store the status of the radio button to the variable $selt in the same page also. if you can please tell me how can i check the status of the radio button in another page, and how can i store its value to variable $selt in the same page. thanks for help, i am really new in this. Quote Link to comment Share on other sites More sharing options...
laPistola Posted November 17, 2008 Share Posted November 17, 2008 echo" <form action="$_SERVER[php_SELF]"><input type='radio' id+payment_type1" name='payment_type1' value='complete' checked> Complete <input type='radio' name='payment_type2' id="payment_type2" value='incom'>incom </form>"; above code will post the form data to the same page put put the below code before any html <?php $pt1 = $_POST['payment_type1']; $pt2 = $_POST['payment_type2']; selt = "-1"; if ($pt1=='complete') { $selt = $pt1; } else if ($pt2=='incom') { $selt = $pt2; } $pta = array("complete","incom"); if (selt==$pta) { header("loaction: URL-TO-NEXT-PAGE-HERE?pt=".$selt); } ?> if complete is selected this will give you to a url of URL.php?pt=complete in the next page you can call the status buy using $_GET['pt']; 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.