0

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'].'">'; ?>
4
Contributors
4
Replies
9
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

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>';

Edited by chrishea: n/a

0

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

0

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;
-1

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.

Edited by rajarajan07: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.