|
|
#1 |
|
Member
Join Date: Aug 2008
Posts: 63
Rep Power: 4 ![]() |
Hi,
I am trying to capture a user's date of birth during the registration page in 3 fields. I want to use the "extra" field to store the date of birth, however, at the point at which i am capturing the date I am displaying 3 fields to the user (1 for day, 1 for month and 1 for year). I then want to capture what the user has entered in these 3 fields and concatenate all three values as an input to the "extra" field so it can be saved in the database. I have also made the "extra" field a hidden text field as there is no need for the user to see this. The issue i am getting is the extra field always stays blank. I have used the following code, anyone got any ideas what I am doing wrong or smaple code to help resolve this issue? within userjoin.tpl (I have removed the actual code to populate the values for the drop downs to save on space): {if $dis_extra=="Y"} {* Date of Birth *} <tr> <td class="formleft">{$extra_text}{$smarty.const.LANG_ COLON}</td> <td class="formright"> <select name="BirthDays" id="BirthDays"> ...code to populate the days dropdown... </select> <select nameid="BirthMonths" id="BirthMonths"> ...code to populate the months dropdown... </select> <select name="BirthYears" id="BirthYears"> ...code to populate the years dropdown... </select> {if $req_extra=="Y"} <span class='required'>{$smarty.const.LANG_STAR}</span>{/if} <td class="formright"><input type="hidden" name="extra" id="extra" value="{$BirthDays}{$BirthMonths}{$BirthYears}" /></td> </td> </tr> {/if}
__________________
Many Thanks, Nagrap2 Developer Version 4.1 |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Mar 2006
Posts: 4,114
Rep Power: 101 ![]() ![]() |
__________________
Larry. (Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free) Set your site apart from the competition with one of my modules...... Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module 68 Classifieds Important Links Customer Area | Issue Tracker | Knowledge Base | User Manuals |
|
|
|
|
|
#3 |
|
Member
Join Date: Aug 2008
Posts: 63
Rep Power: 4 ![]() |
Larry,
I wasnt sure how the above applies to my scenario? As none of my vairables have anything other than letters?
__________________
Many Thanks, Nagrap2 Developer Version 4.1 |
|
|
|
|
|
#4 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,776
Rep Power: 110 ![]() |
Actually I can only think of two ways of doing this.
1. Use javascript and a hidden form element that would take the values from those three and join them into one hidden field. 2. Edit the php and join those three into the one variable the script uses.
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
|
|
#5 |
|
Moderator
Join Date: Mar 2006
Posts: 4,114
Rep Power: 101 ![]() ![]() |
The reason I pointed you to that page has nothing to do with your variables containing only letters. I pointed you to that page as a possible solution by using back tics.
The truth of the matter is im not even sure if your approach will work. The smarty variables declared to hold the various pieces of the birth date arent technically populated yet as far as smarty and the scripts are concerned because the form hasnt been submitted. Another approach would be to do the concatenation at the PHP level.
__________________
Larry. (Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free) Set your site apart from the competition with one of my modules...... Google Map Module | You Tube Module | Google Calendar Module | Event Calendar Module 68 Classifieds Important Links Customer Area | Issue Tracker | Knowledge Base | User Manuals |
|
|
|
|
|
#6 |
|
Member
Join Date: Aug 2008
Posts: 63
Rep Power: 4 ![]() |
Larry / Eric,
Thanks.... so if i were to do the concatenation at the php level can you give me some sample code? I just need a pointer to get me started... which file would I edit, is it the userjoin.php?
__________________
Many Thanks, Nagrap2 Developer Version 4.1 |
|
|
|
|
|
#7 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,776
Rep Power: 110 ![]() |
Yes userjoin.php.
Find: // Build an array from the submitted form values Just below it add your new values and assign them to a variable: $myextra = $_POST['BirthDays'] . $_POST['BirthMonths'] . $_POST['BirthYears']; Then replace one of these with your new variable: Code:
'extra'=>trim(@$_POST['extra']),
'extra2'=>trim(@$_POST['extra2']),
'extra3'=>trim(@$_POST['extra3']),
'extra2'=>$myextra,
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
|
|
#8 |
|
Member
Join Date: Aug 2008
Posts: 63
Rep Power: 4 ![]() |
Eric,
That's fantastic, it worked !!! OK last question, I would also want to provide the user with the option of updating this via "Modify User Account" option. I will write some logic to retrieve the data from the "extra" field and strip it down so it displays the data again in 3 fields. However, on submit, what would I modify within useraccountmodify.php to be able to save the user's changes? I see the following code that looks similar to what I changed within userjoin.php: $data['extra'] = isset($_POST['extra']) ? $format->inputSQL($_POST['extra'], 'string') : '';
__________________
Many Thanks, Nagrap2 Developer Version 4.1 |
|
|
|
|
|
#9 |
|
68 Classifieds Staff
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,776
Rep Power: 110 ![]() |
Yes you would just edit that line:
$data['extra'] = isset($_POST['extra']) ? $format->inputSQL($_POST['extra'], 'string') : ''; Becomes: $myextra = $_POST['BirthDays'] . $_POST['BirthMonths'] . $_POST['BirthYears']; $data['extra'] = isset($myextra) ? $format->inputSQL($myextra, 'string') : '';
__________________
Eric Barnes 68 Classifieds Developer Please do not send me a private message asking for support. Instead use these open forums or our ticket system. Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | 68 @ Twitter | My Modules |
|
|
|
|
|
#10 |
|
Member
Join Date: Aug 2008
Posts: 63
Rep Power: 4 ![]() |
Thanks Eric that worked perfect !!!!!
__________________
Many Thanks, Nagrap2 Developer Version 4.1 |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Copy/Past website URL from the ad | HorseOptions | HTML, CSS, and Design Help | 3 | 12-04-2008 05:35 PM |
| Run 2nd copy 68C on local machine.... | RandyB | v4 Questions & Support | 3 | 11-25-2008 02:24 PM |
| Copy listings | euroclassifieds | v4 Questions & Support | 1 | 07-05-2008 07:50 AM |
| 2nd copy of 68 Classifieds | seymourjames | Pre Sales Questions | 3 | 05-15-2008 10:57 AM |