iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-20-2007, 03:52 PM
WebProWorld Pro
 
Join Date: Jul 2003
Location: Canada
Posts: 272
ackerley1 RepRank 0
Default Combining Values before form submission

I am curious to know if there is a way to combine values from two drop down options (Month and Year) as on CC form, into one variable prior to the form being submitted.

I generate my drop down options prior initiating the form like this:

// Month Selector
for ($x=1;$x<=12;$x++) {
if ($x<=9) {
$a="0".$x;
} else {
$a=$x;
}
$values_a.="<option value='$a'>$a</option>";
}
// Year Selector
for ($y=7;$y<=20;$y++) {
if ($y<=9) {
$b="200".$y;
} else {
$b="20".$y;
}
$values_b.="<option value='$b'>$b</option>";
}

echo "<form method=post

And display them on the form like this:

<tr>
<td>
Expiration date
</td>
<td>
<select name=varExpDate>$values_a</select><select name=varExpDate>$values_b</select>
</td>
</tr>

So I need to combine both of them into one variable before sending it off for processing.

Any help would be appreciated.

Thanks
__________________
Rob
Reply With Quote
  #2 (permalink)  
Old 09-20-2007, 04:25 PM
WebProWorld Veteran
 
Join Date: Aug 2003
Location: Cornwall, UK
Posts: 972
speed RepRank 1
Default Re: Combining Values before form submission

You can use JavaScript to combine the values and store them in a hidden field.

However if the user doesn't have JavaScript enabled then the value won't be combined, mind neither would the options be generated. It's far better to do everything server side that matters.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on passing values into a sql statement from a form? jpdeveloper Database Discussion Forum 15 02-15-2006 10:53 AM
ASP-form passing parameter values into another file?? jpdeveloper Web Programming Discussion Forum 3 02-07-2006 06:06 PM
multiple values from form in php Jerry Web Programming Discussion Forum 3 09-20-2005 03:34 PM
Reading & Posting HTML form values in PHP jrobin747 Web Programming Discussion Forum 0 03-11-2005 10:02 AM
php form submission wclew Web Programming Discussion Forum 12 11-12-2003 05:11 PM


All times are GMT -4. The time now is 04:06 AM.



Search Engine Optimization by vBSEO 3.3.0