By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

combining textfields to form a variable data and thend sending through URL

P: 20

I am trying to get a couple of text field entered in the text boxes and am then wanting to concatenate the data into one PHP variable. Finally i want to send the php variable in the action command through the URL of the next page. please let me know how to do this.

Expand|Select|Wrap|Line Numbers
  1. <p align="center">
  2.                                                      <input name="textfield" type="text" size="5" maxlength="3"> 
  3.                                                      &nbsp; . &nbsp; 
  4.                                                      <input name="textfield2" type="text" size="5" maxlength="3"> 
  5.                                                      &nbsp; . &nbsp;
  6.                                                      <input name="textfield3" type="text" size="5" maxlength="3"> 
  7.                                                      &nbsp; . &nbsp;
  8.                                                      <input name="textfield4" type="text" size="5" maxlength="3">
  9.                                                      &nbsp;&nbsp;</p>
  11.                                     <?PHP 
  12.                                     $IP = echo  "'textfield'.'textfield2'.'textfield3'.'textfield4'";
  13.                                     ?>
the above code is how i am trying to concatenate the different textboxes data into one PHP variable. Please let me know if i am doing it incorrectly.

Now I want to pass that variable as a paramter in action command as location.php?IP=$IP... something like this. Please help.
Expand|Select|Wrap|Line Numbers
  1. <form name="contact_form" method="get" action= "location.php" onsubmit="return validate_form ( );">
Oct 3 '08 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 6,050
You managed to get one set of code tags right. Remember it's [code] that format.
Oct 3 '08 #2

Expert 5K+
P: 5,058

I think a tutorial or two about HTML forms would help.
This is pretty basic stuff and there is no shortage on information on this topic online. (Google never fails)

Maybe this article could get you started.
Oct 4 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.