0
我是PHP新手,我在下面提到了我的HTML和PHP代碼。我無法將文本框(我在文本框名稱下面提到)賦值給PHP。我在下面提到了HTML和PHP代碼。PHP&HTML - 無法獲得文本字段值
文本框對此我無法訪問:
Section <input type="text" name="f_b1_s1_sec" id="f_b1_s1_sec">
Content <input type="text" name="f_b1_s1_con" id="f_b1_s1_con"><br><br>
Para <input type="text" name="f_b1_s1_para" id="f_b1_s1_para">
HTML代碼:
<form name="input" action="footer_view.php" onsubmit="return criteria('f', 3)" method="post">
<h1><center><u><font color="Maroon">Footer Issues</font></u></center></h1>
<ul id="tabs">
<li id="tab1"><a href="f_sec.html">Section</a></li>
<li id="tab2"><a href="f_link.html">Link</a></li>
<li id="tab3"><a href="www.google.co.in">Content</a></li>
<li id="tab4"><a href="www.google.co.in">alignment</a></li>
<li id="tab5"><a href="www.google.co.in">Function</a></li>
<li id="tab6"><a href="www.google.co.in">Others</a></li>
</ul>
<br>
Select an Issue <br> <select name="f_d" id="f_d" onchange='drop("f", 3)'>
<option value=00>Select</option>
<option value=01>A section is missing</option>
<option value=02>Section is not aligned properly</option>
<option value=03>A section overlaps another section</option>
</select>
<div id="f_b1" style="display:none;">
Environment <br> <select name="f_b1_s1_env" id="f_b1_s1_env" onchange="envDrop(1, 1)">
<option value="ENG">ENG</option>
<option value="DEV" selected>DEV</option>
<option value="STAGE">STAGE</option>
<option value="WWWTMP">WWWTMP</option>
<option value="LIVE">LIVE</option>
</select>
<input type="checkbox" name="f_b1_s1_sp1" id="f_b1_s1_sp1" onClick="envSpecific(1,1)">Specific
<input type="checkbox" name="f_b1_s1_env1" id="f_b1_s1_env1">ENG
<input type="checkbox" name="f_b1_s1_env2" id="f_b1_s1_env2" disabled>DEV
<input type="checkbox" name="f_b1_s1_env3" id="f_b1_s1_env3" disabled>STAGE
<input type="checkbox" name="f_b1_s1_env4" id="f_b1_s1_env4" disabled>WWWTMP
<input type="checkbox" name="f_b1_s1_env5" id="f_b1_s1_env5" disabled>LIVE
<br><input type="radio" name="f_b1_s1_brw" id="f_b1_s1_brw" onClick="get(1,1,1)" value="browser">Browser
<input type="radio" name="f_b1_s1_brw" id="f_b1_s1_dvc" onClick="get(1,1,2)" value="device">Device
<input type="radio" name="f_b1_s1_brw" id="f_b1_s1_both" onClick="get(1,1,3)" value="both">Both
<div id="f_b1_s1_brww1" style="display:none;">
<select name="f_b1_s1_brow[]" id="f_b1_s1_brow" multiple>
<option value="All">All</option>
<option value="IE 10">IE 10</option>
<option value="IE 9">IE 9</option>
<option value="IE 8">IE 8</option>
<option value="IE 6">IE 6</option>
<option value="FF 25">FF 25</option>
<option value="FF 24">FF 24</option>
<option value="FF 22">FF 22</option>
<option value="CHROME">CHROME</option>
<option value="MAC SAFARI 6.0">MAC SAFARI 6.0</option>
<option value="MAC FF25">MAC FF25</option>
<option value="MAC CHROME">MAC CHROME</option>
<option value="OPERA">OPERA</option>
<option value="IPAD">IPAD</option>
<option value="SOGDU">SOGDU EXPLORER</option>
</select>
<input type="checkbox" name="f_b1_s1_sp2" id="f_b1_s1_sp2">Specific
</div>
<div id="f_b1_s1_brww2" style="display:none;">
<select name="f_b1_s1_dvc1" id="f_b1_s1_dvc1">
<option value="Select">Select</option>
<option value="ALL">ALL</option>
<option value="IOS 7">IOS 7</option>
<option value="IOS 6">IOS 6</option>
<option value="IOS 6 & 7">IOS 6 & 7</option>
<option value="AND 2.3">AND 2.3</option>
<option value="AND 4.0">AND 4.0</option>
<option value="AND 2.3 & 4.0">AND 2.3 & 4.0</option>
<option value="BB">BB</option>
</select>
</div>
<br><br>Pre-Condition<br><select name="f_b1_s1_pc[]" id="f_b1_s1_pc" multiple><br>
<option value="User with no saved address">User with no saved address</option>
<option value="User with only billing address">User with only billing address</option>
<option value="Partial User">Partial User</option>
<option value="Return User">Return User</option>
<option value="User with billing, default shipping and other address">User with billing, default shipping and other address</option>
</select>
<br><br>Test Data </br><textarea rows="3" cols="25" name="f_b1_s1_td" id="f_b1_s1_td"></textarea>
<br><br>Section <input type="text" name="f_b1_s1_sec" id="f_b1_s1_sec">
<br><br>Content <input type="text" name="f_b1_s1_con" id="f_b1_s1_con"><br><br>
Para <input type="text" name="f_b1_s1_para" id="f_b1_s1_para">
<br><br>Additional Observation<br><textarea rows=3 cols=25 name="f_b1_s1_ao" id="f_b1_s1_ao"></textarea>
<br><br>Pages<br><select name="f_b1_s1_pg[]" id="f_b1_s1_pg" multiple><br>
<option value="All">All</option>
<option value="Homepage">Homepage</option>
<option value="Profile">Profile</option>
<option value="Shopping Cart">Shopping Cart</option>
</select>
<input type="hidden" id="f_b1_s1_pg_hid" name="f_b1_s1_pg_hid" value="Homepage">
<br><br>Reference Site with same behavior <input type="text" name="f_b1_s1_rs1" id="f_b1_s1_rs1">
<br><br>Reference Site with not same behavior <input type="text" name="f_b1_s1_rs2" id="f_b1_s1_rs2">
<br/>
</div>
PHP代碼:
$tx0 = $_POST['f_b1_s1_sec'];
$tx1 = $_POST['f_b1_s1_con'];
$tx2 = $_POST['f_b1_s1_para'];
//code for three fields
if ($tx1 == NULL && $tx2 == NULL)
{
if ($tx0 != NULL)
{
$sec_sum = $tx0." section is not displayed.";
$sec_step = "Go to the bottom of the page and look for the ".$tx0." section";
$sec_act = $tx0." section is not displayed.";
$sec_exp = $tx0." section should be displayed.";
$sec_ref1 = $tx0." section is displayed.";
$sec_ref2 = $tx0." section is not displayed.";
}
}
if ($tx0 != NULL && $tx1 != NULL)
{
if ($tx2 == NULL)
{
$sec_sum = $tx1." of ".$tx0." section is not displayed.";
$sec_step = "Go to the bottom of the page and look for the ".$tx0." section";
$sec_act = $tx1." of ".$tx0." section is not displayed.";
$sec_exp = $tx1." of ".$tx0." section should be displayed.";
$sec_ref1 = $tx1." of ".$tx0." section is displayed.";
$sec_ref2 = $tx1." of ".$tx0." section is not displayed.";
}
}
if ($tx0 != NULL && $tx1 != NULL)
{
if ($tx2 != NULL)
{
$sec_sum = $tx1." is not displayed in ".$tx2." para in ".$tx0." section";
$sec_step = "Observe the ".$tx2." para in ".$tx0." section";
$sec_act = $tx1." is not displayed in ".$tx2." para in ".$tx0." section";
$sec_exp = $tx1." should be displayed in ".$tx2." para in ".$tx0." section";
$sec_ref1 = $tx1." is displayed in ".$tx2." para in ".$tx0." section";
$sec_ref2 = $tx1." is not displayed in ".$tx2." para in ".$tx0." section";
}
}
謝謝!
在你的html中,我沒有看到一個/表單標籤。在您發佈的代碼下方是否有一個? – larsAnders
您的表單未關閉,您需要在所有HTML字段呈現後關閉它作爲。 –
你怎麼知道你沒有得到它們,你是否嘗試回顯它們或'print_r($ _ POST)'?此外,什麼是「標準()」 – AbraCadaver