将下拉菜单转到另一页

时间:2013-03-23 05:03:07

标签: php forms drop-down-menu

在为add运算符加载表单之前,我必须使用php文件addoperator.php调用一个web服务,它返回了一个json,其中包含组织,位置,构建的值,我已将json值转换为dropdown ,现在这些下拉必须在字段组织,位置和建筑物的形式下添加运营商。

她是addoperator.php的代码

<?php
session_start();
$url='webservice url';
$ch=curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($useridofuser));
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
    $response=  curl_exec($ch);
    echo('\n'."Server response : \n \n".$response);
    curl_close($ch);
    //parsing the json response from server
    $jsonde="$response";
$org = array();
$loc = array();
$bui = array();
$items = json_decode($response);
foreach( $items as $each ){
$loc[]=$each->location[0]->name;
$bui[]=$each->location[0]->building[0];
$org[]=$each->name;
}
?>
<select name="category_id">
<option value=""></option>
<?php
foreach($org as $key=>$val)
{?>
<option value="<?php echo $key; ?>"><?php echo $val; ?></option>
<?php
}
?>
</select>
<select name="category_id">
<option value=""></option>
<?php
foreach($loc as $key=>$val)
{?>
<option value="<?php echo $key; ?>"><?php echo $val; ?></option>
<?php
}
?>
</select>
<select name="category_id">
<option value=""></option>
<?php
foreach($bui as $key=>$val)
{?>
 <option value="<?php echo $key; ?>"><?php echo $val; ?></option>
 <?php
}
?>
</select>

添加运算符的UI是addoperatorui.php(如何将addoperator.php下拉到addoperatorui.php)

<h3>ADD ROUTER </h3>
    </div>
        <form method="post" action="login.php" >
         <table border="0" >
         <tr><td>Username</td>
          <td><input type="text" name="userid"></td></tr>
                <tr><td>Password</td>
                    <td><input name="password" type="password"></td></tr>
                <tr><td>Confirm Password</td>
                    <td><input name="password1" type="password"></td></tr>
                <tr><td>Email</td>
                    <td><input name="email" type="email"></td></tr>
                <tr><td>Organisation Name</td>
                    <td><input name="orgname" type="text"></td></tr>
                <tr><td>Location</td>
                    <td><input name="location" type="text"></td></tr>
                <tr><td>Building</td>
                    <td><input name="building" type="text"></td></tr>
                <tr><td>Department</td>
                    <td><input name="department" type="text"></td></tr>
<?php
$oneYearOn = date('Y-m-d',strtotime(date("Y-m-d", mktime()) . " + 7300 day"));
//echo $oneYearOn;
$oneYearOn1=date('Y-m-d',strtotime(date("Y-m-d", mktime()) . " + 40day"));
//echo $oneYearOn1;
?>
  <tr><td>Sub Category</td>
  <td>
  <select id="Ultra" onchange="run()">  <!--Call run() function-->
 <option value="0">Select</option>
 <option value="<?=$oneYearOn?>">Employee</option>
 <option value="<?=$oneYearOn1?>">Temporary</option>
 </select>  
 </td>
</tr> <tr><td>First Name</td>
                    <td><input name="firstname" type="text"></td></tr>
                <tr><td>Last Name</td>
                    <td><input name="lastname" type="text"></td></tr>
                <tr><td>Land Phone</td>
                    <td><input name="landphone" type="number"></td></tr>
                <tr><td>Mobile</td>
                    <td><input name="mobile" type="number"></td></tr>
                <tr><td>Expiry date</td>
                    <?php
                    ?>
 <td><input type="text" id="srt" placeholder="get value on option select"><br></td></tr>
                <tr><td>Opcode</td>
                    <td><input name="opcode" type="text"></td></tr>
                <tr><td>Expiry date</td>
                    <td><input name="expirydate" type="date"></td></tr>
                <tr><td>Image</label></td>
                      <td><input type="file" name="image"></td></tr>

                <tr><td><input type="submit" value="Submit"/></td></tr>
            </table>
        </form>

0 个答案:

没有答案