0

i want to passing radio button values to another page via session post variable but problem is that in another page radio button values didn't display in the page via session

need to help to solve this issue thank you

Index Page Function & Source Code

Php Function

<?php 
session_start();
$_SESSION['sizes1'][]=$_POST['size'];
?>

Javascript Function

 $(document).ready(function () {
 $('.form-radios label').attr('checked', 'unchecked');
 $(".form-radios label").click(function(){
 $(this).attr('checked', 'checked').addClass('checked');
 $('label').not(this).removeClass('checked');
 });     
 });

Index Page Form

<form action="test.php" method="post">
<div class="form-radios">
<label>Small</label>
<input type="radio" name="size[]" id="small" value="small"/>
<label>Medium</label>
<input type="radio" name="size[]" id="medium" value="medium"/>
<label>Large</label>
<input type="radio" name="size[]" id="large" value="large"/>
<label>Xl</label>
<input type="radio" name="size[]" id="xl" value="xl"/>
</div><br />
<input type="submit" value="submit" />
</form>

Test Page Php Function

<?php 
session_start();
echo $new_sizes=implode($_SESSION['sizes1']);

$max=count($new_sizes);
for($i=0; $i<=$max++; $i++)
{
?>
<input type="text" value="<?php $new_sizes [$i] ?>" />
<?php  } ?>
4

1 回答 1

0

您正在访问错误的帖子值,即 $_POST['image1']、$_POST['product'] 等实际上并不存在于您的表单中。

于 2013-04-17T10:02:16.297 回答