0
我有一個表格得到下拉列表中選擇下一個頁面上的指數
,其作用是test4.php
<h1>Signup for Free Account</h1>
<div class="login-fields">
<p>Create your free account:</p>
它需要用戶名
<div class="field">
<label for="firstname">First Name:</label>
<input type="text" id="firstname" name="firstname" value="" placeholder="First Name" onBlur="validate(this,document.getElementById('FName'));" class="login" />
<span id="FName" class="help"></span>
</div> <!-- /field -->
它採取用戶姓氏
<div class="field">
<label for="lastname">Last Name:</label>
<input type="text" id="lastname" name="lastname" value="" placeholder="Last Name" class="login" onBlur="validate(this,document.getElementById('LName'));" />
<span id="LName" class="help">
</div>
<!-- /field -->
這需要電子郵件ID
<div class="field">
<label for="email">Email Address:</label>
<input type="text" id="email" name="email" value="" placeholder="Email" class="login" onBlur="validate(this,document.getElementById('Uemail'));" />
<span id="Uemail" class="help">
</div> <!-- /field -->
它採用獨特的ID爲用戶
<div class="field">
<label for="uniqueid">Unique Id:</label>
<input type="text" id="uniqueid" name="uniqueid" value="" placeholder="Unique Id" class="login" onBlur="validate(this,document.getElementById('Uid'));" />
<span id="Uid" class="help">
</div> <!-- /field -->
它需要密碼
<div class="field">
<label for="password">Password:</label>
<input type="password" id="password" name="password" value="" placeholder="Password" class="login" onBlur="validate(this,document.getElementById('pwd'));" />
<span id="pwd" class="help">
</div> <!-- /field -->
它符合密碼
<div class="field">
<label for="confirm_password">Confirm Password:</label>
<input type="password" id="confirm_password" name="confirm_password" value="" placeholder="Confirm Password" class="login" onBlur="validate(this,document.getElementById('cpwd'));" />
<span id="cpwd" class="help">
</div> <!-- /field -->
這需要貨幣
<div class="field">
<label for="currency">Currency:</label>
<select id="currency" name="currency">
<option value="0">Indian Rupee</option>
<option value="1">US Dollar</option>
<option value="2">Euro</option>
<option value="3">Yen</option>
<option value="4">Pound</option>
<option value="5">Australian Dollar</option>
<option value="6">Canadian Dollar</option>
<option value="7">Swedish Krone</option>
<option value="8">Hong Kong Dollar</option>
<option value="9">New Zealand Dollar</option>
</select>
</div> <!-- /field -->
</div> <!-- /login-fields -->
<div class="login-actions">
<input type="submit" class="button btn btn-primary btn-large" id="subReg" value="Register"/>
</div> <!-- .actions -->
</form>
而在test4.php
我取它像
$currency= $_REQUEST['currency'];
但我誤差
Notice: Undefined index: currency in C:\xampp\htdocs\money_manager\test4.php
如何檢索selected index value
上test4.php
驗證所有功能用於js檢查
function validateAll()
{
var Gfn=document.getElementById("firstname");
var Gln=document.getElementById("lastname");
var Gid=document.getElementById("uniqueid");
var Gemail=document.getElementById("email");
var Gpwd=document.getElementById("password");
var Gcpwd=document.getElementById("confirm_password");
if(Gfn.value.length === 0)
{
document.getElementById("FName").innerHTML="This field can not be empty.";
firstname.focus();
return false;
}
if(Gln.value.length === 0)
{
document.getElementById("LName").innerHTML="This field can not be empty.";
lastname.focus();
return false;
}
if(Gemail.value.length === 0)
{
document.getElementById("Uemail").innerHTML="This field can not be empty.";
email.focus();
return false;
}
if(Gid.value.length === 0)
{
document.getElementById("Uid").innerHTML="This field can not be empty.";
uniqueid.focus();
return false;
}
if(Gpwd.value.length === 0)
{
document.getElementById("pwd").innerHTML="This field can not be empty.";
password.focus();
return false;
}
if(Gcpwd.value.length === 0)
{
document.getElementById("cpwd").innerHTML="This field can not be empty.";
confirm_password.focus();
return false;
}
if(validpwd() === "error")
{
document.getElementById("cpwd").innerHTML="Password and confirm password does not match";
confirm_password.focus();
return false;
}
if(validemail() === "error")
{
document.getElementById("Uemail").innerHTML="please enter valid email.";
email.focus();
return false;
}
return true;
}
test4.php與窗體文件位於同一個文件夾中(我們稱之爲'index.php')?我們能否看到更多的表單代碼? – larsAnders
驗證全部代碼? –
如何在下一頁獲取選定的索引..? – user32876