PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
please check it that it is right. I want to save the value of radio button in a variable so that I may use it in further calculation.
Last edited by califdon on Wed Apr 18, 2012 3:35 pm, edited 1 time in total.
Reason:Moderator added syntax=php tags to make code readable. Note to poster, please always do this.
Please help me that how can improve this code.
session_start() is necessary for communication with session.
How can I save the value of radion button in an variable b so that I may use it in future calucaltion.
thanks.
<?php
session_start();
if (isset($_POST['Submit'])) {
$_SESSION['a'][0] = $_POST['type'];
// comparing here, use of == is correct
if($_SESSION['a'][0]== 1000)
// should be =, not ==
{ $b = 1000;}
else
{ $b = 500;}
echo"the no is ".$b;
}
?>
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering