0

私はこの問題を解決する必要がありsession variablesますsession variable

size values問題は、ラジオボタンを選択すると、代わりに表示されるべきaccessoriesですか?

たとえば、私はこのようにしたい

入力値が任意の数値の場合

echo "Accessories"; // It Should Be Display Accessories If
                       Any Kind Of Numbers Enter.

Else If ラジオ選択

echo size name // display size whatever choose 
                  from radio button.

これが私のコードです:

<?php
session_start();
if(isset($_REQUEST['test']))
{
$_SESSION['size1']=$_POST['size'];
$new_sizes=$_SESSION['size1'];
$_SESSION['cid1']=$_POST['cid'];

if(isset($_SESSION['cid1']))    
{
echo "Accessories";
}

else
{
echo $new_sizes;
}
}
?>

<form method="post">
<input type="text" name="cid">
<br>
<label for="Small">Small</label>
<input type="radio" name="size" id="Small" value="Small" />
<label for="Medium" >Medium</label>
<input type="radio" name="size" id="Medium" value="Medium"/>
<label for="Large">Large</label>
<input type="radio" name="size" id="Large" value="Large"/>
<label for="Xl">Xl</label>
<input type="radio" name="size" id="Xl" value="Xl"/>
<br>  
<input type="submit" name="test" value"Submit">
</form>
4

2 に答える 2

0

多分あなたは試してみるべきです

何かのようなもの

if(is_numeric($_SESSION['cid1'])) 
{
  echo "Accessories";   
}
else
{
  echo $new_sizes;
}
于 2013-04-26T22:25:44.177 に答える