hi all,
is there anything wrong in this. i need hav the value in the radio button to display in the next page. so please can anyone.
thank u.

---------user.php--------

<tr>
    <td><input name="radio" type="radio" value="projectassign"></td> 
    <td><?php echo $row['projectassign']?></td>

<tr> <td><input name="radio" type="radio" value="projectassign"></td> <td><?php echo $row['projectassign']?></td>

---------upload.php---------

<?php echo '<input type="hidden" name="radio" value="'.$_POST['radio'].'">'; ?>

Recommended Answers

All 4 Replies

If you are trying to display the button again on a second page (e.g. as a confirmation) and you want it to be turned on if it was selected on the first page then you need to use the 'checked' parameter to turn it on:

if ($_POST['radio'] == "projectassign") {
   $button = "checked";
}
else {
   $button = "";
}

echo '<td><input name="radio" $button type="radio"  value="projectassign"></td>';

If you are trying to display the button again on a second page (e.g. as a confirmation) and you want it to be turned on if it was selected on the first page then you need to use the 'checked' parameter to turn it on:

if ($_POST['radio'] == "projectassign") {
   $button = "checked";
}
else {
   $button = "";
}

echo '<td><input name="radio" $button type="radio"  value="projectassign"></td>';

no actually wat my query is i need to display the value of the radio button which i had selected to the next page.
and in that it should be displayed like you have selected this value

try this:

1st page

//some code here
<input type="radio" name="radiogroup" value="someValue1" />someValue1
<input type="radio" name="radiogroup" value="someValue2" />someValue2
//some code here

2nd page

$value = (string)$_POST["radiogroup"];
echo $value;
Member Avatar for rajarajan2017

radio.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>Untitled</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />
	<meta name="description" content="" />
	<meta name="keywords" content="" />
</head>
<body>
<form name="frm1" method="get" action="passed.php">
<input type="radio" name="radiogroup" value="someValue1" />someValue1
<input type="radio" name="radiogroup" value="someValue2" />someValue2
<input type="submit" value="submit" name="commit"/>
</form>
</body>
</html>

passed.php

<?php
$value = (string)$_GET["radiogroup"];
echo $value;
?>

Note: It only retrieves the value inside the tag and not the text given by you. If you want give both the same.

Copy and test the files.

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.