53 users online (0 members and 53 guests)  


  Results 1 to 3 of 3

Related

  1. Passing Javascript variables to a form    Forum: Javascript Forum
    Replies: 0
  2. Variable in Form action field    Forum: Javascript Forum
    Replies: 4
  3. Form Action help    Forum: HTML Forum
    Replies: 1
  4. Trigger form action    Forum: HTML Forum
    Replies: 2
  5. Hidden Form Variables    Forum: HTML Forum
    Replies: 2
  1. #1
    harrija5's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2009
    Posts
    1

    New: Form data to be copied to action variables

    I am trying to create a simple form to capture user, login and a quantity. These items need to be copied to the action= in the form of an api that once logged into a server opens the users account and upgrades a quantity to a new value. So far I found that this can be done using variables and <? echo variable; ?> within the api. What I can't do is figure how to collect the data from the form and supply it to the $variables= .

    A simple illustration of what I have done is below:

    <?
    $variable1 = 'itti';
    $variable2 = '555ttt';
    $variable3 = '100000000';
    ?>

    <form id="form1" name="form1" method="post" action="http://server.com/api/ModifyUser.do?SysUser=bozo&SysPwd=acde3333&LoginName=<?php echo $variable1; ?>&Password=<?php echo $variable2; ?>&Quota=<?php echo $variable3; ?>">
    <p>
    &raquo;&raquo;<label for="username"><b>Username:</b></label>
    <input type="text" name="username" id="username" />
    </p>
    <p>
    &raquo;&raquo;<label for="pwd"><b>Password:</b></label>
    <input type="password" name="pwd" id="pwd" />
    </p><br>

    <p>Make sure you enter <b>numbers only</b> in the New Quantity box. DO NOT use commas <b>,</b> or periods <b>.</b> or any other characters.</p>

    <p>
    &raquo;&raquo;<label for="upgrade"><b>New Quantity:</b></label>
    <input type="text" name="upgrade" id="upgrd" />
    </p>
    <p><center> <input name="register" type="submit" id="register" value="Press Enter" /></center></p>
    </form>

    This all works by just pressing the enter button due to the variable being coded but I cannot grasp the coding to associate the form information to the variables.

    Thank you for your assistance

    Jim

  2. #2
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: New: Form data to be copied to action variables

    Try changing method="post" to method="get".

  3. #3
    shadows_twin's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2009
    Posts
    2

    Lightbulb Re: New: Form data to be copied to action variables

    There are so many things wrong with your example that I'm not going to waste time picking it apart. Just make the two files below. This solution will do what it appears that you are trying to accomplish.


    form.html
    ----------------------------
    <form id="form1" name="form1" method="post" action="form.php">
    <p>
    &raquo;&raquo;<label for="username"><b>Username:</b></label>
    <input type="text" name="username" id="username" />
    </p>
    <p>
    &raquo;&raquo;<label for="pwd"><b>Password:</b></label>
    <input type="password" name="pwd" id="pwd" />
    </p><br>

    <p>Make sure you enter <b>numbers only</b> in the New Quantity box. DO NOT use commas <b>,</b> or periods <b>.</b> or any other characters.</p>

    <p>
    &raquo;&raquo;<label for="upgrade"><b>New Quantity:</b></label>
    <input type="text" name="upgrade" id="upgrd" />
    </p>
    <p><center> <input name="register" type="submit" id="register" value="Press Enter" /></center></p>
    </form>


    form.php
    ----------------------------
    <?php
    header('Location: http://server.com/api/ModifyUser.do?SysUser=bozo&SysPwd=acde3333&LoginName='.$_REQUEST['username'].'&Password='.$_REQUEST['pwd'].'&Quota='.$_REQUEST['upgrade']);
    ?>



Tags for this Thread