我有一个不能正常工作的代码我想什么时候user's select country from drop down select list
?表单提交后,值应该存储到courier array
?
例如
如果用户选择了美国,那么美国应该与abc courier array values
如果值相互匹配,那么$_SESSION['country1']=$abc;
将被创建?
塞诺里奥
我有两家不同的快递公司,我想根据快递公司将国家列表传递到另一个页面?
索引页
<?php
session_start();
if(isset($_REQUEST['test']))
{
$newcountry=$_POST['country'];
//Let's Assume Courier Companies Is Abc
$abc=array($newcountry=>'Usa',$newcountry=>'Uk');
//Let's Assume Another Courier Companies Is Xyz
$xyz=array($newcountry=>'Singapore',$newcountry=>'Germany');
$_SESSION['country1']=$abc;
$_SESSION['country2']=$xyz;
if(isset($_SESSION['country1']) && isset($_SESSION['country2'])){
header('Location:test.php');
}}
?>
<form method="post">
<select name="country" id="country">
<option value="Usa">Usa</option>
<option value="Uk">Uk</option>
<option value="Germany">Germany</option>
<option value="Singapore">Singapore</option>
<input type="submit" name="test" value="Submit" />
</select>
</form>
测试.php
session_start();
echo $country2=implode($_SESSION['country1']);