从下拉列表中获取下一页的选定索引

时间:2014-04-17 15:35:46

标签: php html request html.dropdownlistfor

我有一张表格

谁的行动是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 -->

用户的唯一标识

            <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;
}

1 个答案:

答案 0 :(得分:0)

要么将它放在<form>中,要么重定向到包含URL中所有数据的另一个页面(GET方法)。