У меня есть форма
Чье действие - 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 -->
Требуется идентификатор электронной почты
<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 -->
Для пользователя требуется уникальный идентификатор
<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
я 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;
}
Либо вы поместите его в <form>
либо переадресовываете на другую страницу со всеми данными в URL (метод GET).
index.php
)? Можем ли мы увидеть больше кода формы?