I am working with a php file(WAD Assignment.php) now. If a condition is satisfied, it displays a JRadiobutton option. I want the value of that JRadioButton in my php file. But the value is not coming out. How can I do it? Code is below.

<code=php>

if($row["membership_category"]=="Student member"){
?>
<html>
Enter the number of guests
<form>
<input type="radio" name="guest" value="0" checked> 0 <br />
<input type="radio" name="guest" value="1"> 1 <br />
<input type="radio" name="guest" value="2"> 2 <br />
<input type="radio" name="guest" value="3"> 3 <br />
<input type="button" value="Submit Booking" onclick="WAD Assignment.php">
</form>
</html>
<?php
echo $_GET('guest');
}
}

</code>

try this:

if($row["membership_category"]=="Student member"){
?>
<html>
Enter the number of guests
<form method="get"  action="WAD Assignment.php">
<input type="radio" name="guest" value="0" checked> 0 <br />
<input type="radio" name="guest" value="1"> 1 <br />
<input type="radio" name="guest" value="2"> 2 <br />
<input type="radio" name="guest" value="3"> 3 <br />
<input type="submit" value="Submit Booking">
</form>
</html>
<?php
echo $_GET('guest');
}
}

try this:

if($row["membership_category"]=="Student member"){
?>
<html>
Enter the number of guests
<form method="get"  action="WAD Assignment.php">
<input type="radio" name="guest" value="0" checked> 0 <br />
<input type="radio" name="guest" value="1"> 1 <br />
<input type="radio" name="guest" value="2"> 2 <br />
<input type="radio" name="guest" value="3"> 3 <br />
<input type="submit" value="Submit Booking">
</form>
</html>
<?php
echo $_GET('guest');
}
}

Yeah the same. Error(Fatal error: Function name must be a string in /home/students/accounts/s6666167/hit3324/www/htdocs/AssignmentOne/WAD Assignment.php on line 51) is showing up on echo $_GUEST('guest'); This means guest value is not at all coming out from the JRadioButton. Right?

From your explanation, I didn't realise that you were getting warnings/errors. $_GUEST('guest'); should be $_GUEST['guest'];

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.