Results 1 to 3 of 3
Related
-
Passing Javascript variables to a form Forum: Javascript Forum
Replies: 0 -
Variable in Form action field Forum: Javascript Forum
Replies: 4 -
Form Action help Forum: HTML Forum
Replies: 1 -
Trigger form action Forum: HTML Forum
Replies: 2 -
Hidden Form Variables Forum: HTML Forum
Replies: 2
-
03-05-2009, 08:01 PM #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>
»»<label for="username"><b>Username:</b></label>
<input type="text" name="username" id="username" />
</p>
<p>
»»<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>
»»<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
-
03-05-2009, 11:23 PM #2
Re: New: Form data to be copied to action variables
Try changing method="post" to method="get".
-
03-07-2009, 02:51 PM #3
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>
»»<label for="username"><b>Username:</b></label>
<input type="text" name="username" id="username" />
</p>
<p>
»»<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>
»»<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']);
?>
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum