Hi,i trying to make array to input form,and then perform selected data.
So for example here we have array which contain data one,two,three.
Currently it generates form where each this data have form.And when i click submit,i want to execute operation only for selected data,not all.
First variable was not even found when i added it as echo on ifelse part,
then i added serialize which made it work but then it generate as output array with only data,and it should be only selected data without any characters which are usually showed on array output.
<html>
<head></head>
<body>
<link rel="stylesheet" type="text/css" href="blog.css" />
<?php
$out = array('one', 'two','three' );
$str = serialize($out);
if (!isset($_POST['submit']))
{
?>
<?php
foreach($out as $name ){
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<div align="center"><?php echo"$name";?>
<input type="radio"name="msg" value="operationone">operationone</input>
<input type="radio" name="msg" value="operationtwo">operationtwo</input>
</div>
<?php
}
?><div align="center"><input type="submit" name="submit" value="Go"></input></div>
</form>
<?php
}
else
{
if ($_POST['msg']=="operationone")
echo "$str";
elseif ($_POST['msg']=="operationtwo")
echo "Have a nice Sunday!";
else
echo "Have a nice day!";
}
?>
</body>
</html>