我想自动提交选择选项值,当用户使用我的表单提交时,然后以表格格式显示响应。我可以使用数组来提交值,但它仅适用于单选按钮,不适用于选择选项。
<?php
require_once('simple_html_dom.php');
$ch = curl_init();
//$val = $_GET['search'];
$val = "3740567871873";
$data = array('ctl00$ContentPlaceHolder1$txtpermitno'=>$val,'ctl00$ContentPlaceHolder1$cmbSearchBy' => 'CNIC');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_TIMEOUT, 40);
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_URL, "http://islamabadpolice.gov.pk/edlv/");
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
ob_start();
$html = curl_exec ($ch);
$dom = new simple_html_dom();
echo $dom->load($html);
foreach($dom->find('tr') as $e)
return $msg = '<span style="font-family:helvetica;">'.$e.'</span><br><br>';
?>
</body>
</html>
Select Option HTML Code
<select name="ctl00$ContentPlaceHolder1$cmbSearchBy"id="ContentPlaceHolder1_cmbSearchBy" class="ddl" style="width:170px;">
<option selected="selected" value="--select--">--select--</option>
<option value="CNIC">CNIC</option>
<option value="Licence No.">Licence No.</option>
</select>