Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2005

    Unanswered: keep the values when it redirect the same page


    I have a question.

    I made the create the new user form.

    <script language="javascript">

    function submitFrm()
    function Validate()
    var username = document.submitform.username.value;
    var password = document.submitform.password.value;
    var email =;
    var str = ""

    if (username=="")
    if (password=="")
    {str=str + "\nPassword";}
    if (email=="")
    {str=str + "\nE-Mail";}

    if (username=="" || password=="" || email=="")
    { alert("Please Fill out the following field:\n\n" + str);}
    else {return submitFrm();}

    <form name="submitform" method="post" action="" OnSubmit="Validate()">
    <table border=2>
    <tr><td>First Name:</td><td><input type="text" name="fname" size="32" /></td></tr>
    <tr><td>Last Name:</td><td><input type="text" name="lname" size="32" /></td></tr>
    <tr><td>Sex:</td><td><input type="radio" name="sex" value="Male">Male</input>
    <input type="radio" name="sex" value="Female">Female</input></td></tr>
    <tr><td>Username:</td><td><input type="text" name="username" size="32" /></td></tr>
    <tr><td>Password:</td><td><input type="password" name="password" size="32" /></td></tr>
    <tr><td>E-Mail:</td><td><input type="text" name="email" size="32" /></td></tr>
    <tr><td></td><td><center><input type="submit" value="Submit" /><input type="reset" value="reset" /></center></td></tr>
    if request.querystring("new")="exists" then
    Response.Write("Username already exists in database.")
    end if

    It works fine, but I want to keep back the Firstname, lastname, sex, and e-mail values. How can I keep the values once it redirect the newuser page.

    Because, if there is one invalide value, then it will redirect the same page and remove all values I input.

    How can I keep firstname, lastname, sex, and e-mail values?

  2. #2
    Join Date
    Mar 2006
    south jersey, usa
    you are posting the data so you can pick it up on the next page using request.form("fieldname")


    case "user" ' show page to select user(s)
      dim srs
      sqlserver = request.form("db") 'get database name from input
      sqluser = request.form("user") 'get sql user from input
      sqlpwd = request.form("pass") 'get sql pwd from input
      sqldb = request.form("dbname") 'get db name from input
      set sconn = CreateObject("ADODB.Connection") 'prep connection to sql 
      set srs = CreateObject("ADODB.Recordset") 'prep recordset for login names "PROVIDER=SQLOLEDB;DATA SOURCE=" & sqlserver & ";UID=" & sqluser &_
                 ";PWD=" & sqlpwd & ";DATABASE=" & sqldb 'connect to sql %>
      <div id=pageheader>
      <center><h1>Pick a User or Pick All Users</h1>
      <form name=login method=post action=<%= request.servervariables("script_name") %>?action=exe><%
      response.write "<input type=hidden name=db value='" & request.form("db") & "'>"
      response.write "<input type=hidden name=user value='" & request.form("user") & "'>"
      response.write "<input type=hidden name=dbname value='" & request.form("dbname") & "'>"
      response.write "<input type=hidden name=pass value='" & request.form("pass") & "'>"
      query = "select loginname from irsysusers where status = 12 order by loginname" query, sconn
    "They say Moses split the Red Sea
    I split the blunt and rolled the fat one, I'm deadly"
    -- Tupac 'Blasphemy'

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts