Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 send the value of multiple form variables to server at once...
Index -> Graphics and Design, Web Design -> (X)HTML Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Geminias




PostPosted: Fri Apr 04, 2008 9:08 am   Post subject: send the value of multiple form variables to server at once...

Hi... long story short I need to send via POST the values of multiple form variables WITHOUT a different submit button for each one.

Should I be looking at javascript? Or is there a way to specify which variables to send with a submit button?
Sponsor
Sponsor
Sponsor
sponsor
jernst




PostPosted: Fri Apr 04, 2008 9:24 am   Post subject: Re: send the value of multiple form variables to server at once...

you should be able to send as many variables as you want, you just give them different names...
for example:

code:

<form action="simpleform.php" method="POST">
<p><strong>Name:</strong><br>
<input type="text" name="user">
<p><strong>Address:</strong><br>
<textarea name="address" rows="5" cols="40"></textarea>
<P><input type="submit" value="send"></p>
</form>


this form will send the information from the "user" variable and the "address" variable. Then you can use something like php and retrieve it on the server side with

code:

$user = $_POST['user'];
$address = $_POST['address'];
Geminias




PostPosted: Fri Apr 04, 2008 10:11 am   Post subject: RE:send the value of multiple form variables to server at once...

Thanks. The problem is I have different forms and I'd like to send the values of all of them at the same time. For instance there is a radio button control that lets you choose the mode, and then there are drop down boxes to choose specific items. I want to send the mode and the item chosen in the drop downs. They have to be seperate forms because they are located in different areas, and there are more than one form for drop down boxes.

Thanks.
jernst




PostPosted: Fri Apr 04, 2008 10:28 am   Post subject: Re: send the value of multiple form variables to server at once...

Yeah your right then I think javascript may be a good way to go for that.
Tony




PostPosted: Fri Apr 04, 2008 11:57 am   Post subject: Re: RE:send the value of multiple form variables to server at once...

Geminias @ Fri Apr 04, 2008 10:11 am wrote:
They have to be seperate forms because they are located in different areas...

I think that's a pretty horrible design, although that's not the point of the discussion.

Yes, you could use JavaScript to submit multiple forms, triggered by a single event. Keep in mind though, that the forms will be submitted separately, as in separate requests.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
OneOffDriveByPoster




PostPosted: Fri Apr 04, 2008 2:28 pm   Post subject: Re: send the value of multiple form variables to server at once...

You can make your forms into one (and still keep the layout)...
HTML:
<form action="" method="get"><div>Hello</div></form>
Display posts from previous:   
   Index -> Graphics and Design, Web Design -> (X)HTML Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: