Forums

Automatic email address retrieval

jmirenzi 10 Nov, 2008
Hi
I am new to ChronoForms and Joomla in general, so I have a couple questions. First of all, is it possible to store the user's email address automatically in the table. I see that the user ID number is stored, but I can't seem to figure out how to get an email address. Basically my form will be used for a newsletter subscription, so automatic email address retrieval is really needed.
Also, is there a way to easily view the table that is connected to the form within Joomla?
And, last but not least, is there a way to display the information from my form on another page, so that the users could view their newsletter subscriptions and unsubscribe if they want?

Any help is greatly appreciated,
Thanks
Max_admin 10 Nov, 2008
Hi jmirenzi,

is it possible to store the user's email address automatically in the table



yes, in your form code, put this :


<?php
$user = JFactory::getUser();
?>
<input type="hidden" name="useremail" value="<?php echo $user->email; ?>">


is there a way to easily view the table that is connected to the form within Joomla?



if the table is connected to the form then you should see it in the forms manager beside the form!! clicking the link of the table name will show the data there!

is there a way to display the information from my form on another page, so that the users could view their newsletter subscriptions and unsubscribe if they want?



well, yes, but not easy, you will need to get familiar with ChronoConnectivity because it provides an easy way to do this!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jmirenzi 11 Nov, 2008
Ok thanks for the suggestions.

Now, I built my form using the wizard, however when I view it, I get this error message at the top of the screen:

Parse error: syntax error, unexpected '-', expecting ',' or ';' in /home/moun4373/public_html/components/com_chronocontact/chronocontact.php(41) : eval()'d code on line 13

I tried different scenarios, and the error only seems to appear when the connected table has the fields of my checkboxes checked off so that I can view them (the create column box is checked). Could this happen because of the fact that I used multiple checkbox elements in the wizard? How can I fix this?

Also, where exactly should I put the code to retrieve the user email. I see that there are fields for "Extra Code" as well as the auto-generated code, and then the html.

Thanks.
Max_admin 11 Nov, 2008
show me your form code!

what do you want to do with the user's email ? store it in the table ?

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
jmirenzi 11 Nov, 2008
This is the html code

<div  class="form_item"><div class="form_element cf_heading"><h1 id="" class="cf_text">Snow Reports - Text Message (SMS)</h1></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_text"><span class="cf_text">Complete the following form and submit it to receive your text message snow reports. Note that all fields are required.</span></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_text"><span class="cf_text">Please take the time to read our Text Messaging Terms & Conditions, as submitting this forms implies that you accept them. (NOTE: MountainJunkee.ca is NOT responsible for ANY fees induced by your cell phone service provider)</span></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_heading"><h4 id="" class="cf_text">Cell Phone Information</h4></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_textbox"><label class="cf_label">Cell Phone Number</label><input class="cf_inputbox required validate-number" maxlength="10" size="10" id="text_5" name="text_5" type="text"><a onclick="return false;" class="tooltiplink"><img  src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div  class="tooltipdiv">Cell Phone Number :: Cell Phone Number - Must be 10 digits, include an area code and omit any dashes or spaces.</div></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_dropdown"><label class="cf_label">Carrier/Provider</label><select class="cf_inputbox" id="select_7" size="1" name="select_7"><option value="Rogers">Rogers</option><option value="Bell">Bell</option><option value="Telus">Telus</option><option value="Fido">Fido</option><option value="Solo">Solo</option><option value="Koodo">Koodo</option><option value="Virgin">Virgin</option><option value="PC Mobile">PC Mobile</option></select><a onclick="return false;" class="tooltiplink"><img  src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div  class="tooltipdiv">Carrier/Provider :: If your carrier is not listed, it is unfortunately not supported by our system. However we are always working hard to extend our service and welcome any feedback.</div></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_heading"><h4 id="" class="cf_text">Resorts</h4></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_text"><span class="cf_text">(please select at least one, and note that our list will continue to expand)  </span></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_checkbox"><label class="cf_label">Ontario</label><div class="float_left"><input value="Blue Mountain" class="radio" id="Blue_Mountain" name="Blue_Mountain" type="checkbox"><label for="Blue_Mountain" class="check_label">Blue Mountain</label><br><input value="Mount St. Louis Moonstone" class="radio" id="Mount_St. Louis Moonstone" name="Mount_St. Louis Moonstone" type="checkbox"><label for="Mount_St. Louis Moonstone" class="check_label">Mount St. Louis Moonstone</label><br><input value="Horseshoe" class="radio" id="Horseshoe" name="Horseshoe" type="checkbox"><label for="Horseshoe" class="check_label">Horseshoe</label><br></div></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_checkbox"><label class="cf_label">Québec</label><div class="float_left"><input value="Mont Tremblant" class="radio" id="Mont_Tremblant" name="Mont_Tremblant" type="checkbox"><label for="Mont_Tremblant" class="check_label">Mont Tremblant</label><br><input value="Mont Sainte-Anne" class="radio" id="Mont_Sainte-Anne" name="Mont_Sainte-Anne" type="checkbox"><label for="Mont_Sainte-Anne" class="check_label">Mont Sainte-Anne</label><br><input value="Mont Saint-Sauveur" class="radio" id="Mont_Saint-Sauveur" name="Mont_Saint-Sauveur" type="checkbox"><label for="Mont_Saint-Sauveur" class="check_label">Mont Saint-Sauveur</label><br></div></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_checkbox"><label class="cf_label">BC</label><div class="float_left"><input value="Whistler" class="radio" id="Whistler" name="Whistler" type="checkbox"><label for="Whistler" class="check_label">Whistler</label><br><input value="Big White" class="radio" id="Big_White" name="Big_White" type="checkbox"><label for="Big_White" class="check_label">Big White</label><br><input value="Panorama Mountain" class="radio" id="Panorama_Mountain" name="Panorama_Mountain" type="checkbox"><label for="Panorama_Mountain" class="check_label">Panorama Mountain</label><br></div></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_checkbox"><label class="cf_label">Alberta</label><div class="float_left"><input value="Lake Louise" class="radio" id="Lake_Louise" name="Lake_Louise" type="checkbox"><label for="Lake_Louise" class="check_label">Lake Louise</label><br><input value="Sunshine Village" class="radio" id="Sunshine_Village" name="Sunshine_Village" type="checkbox"><label for="Sunshine_Village" class="check_label">Sunshine Village</label><br><input value="Marmot Basin" class="radio" id="Marmot_Basin" name="Marmot_Basin" type="checkbox"><label for="Marmot_Basin" class="check_label">Marmot Basin</label><br></div></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_button"><input value="Submit" name="undefined" type="submit"><input value="Reset" type="reset"><a onclick="return false;" class="tooltiplink"><img  src="components/com_chronocontact/css/images/tooltip.png" class="tooltipimg" border="0" width="16" height="16"></a><div  class="tooltipdiv">Submit :: Submitting this form confirms that you accept our terms and conditions!</div></div><div class="clear"> </div></div>


And this is the auto-generated code

<?php
		if($paramsvalues->dbconnection == "Yes"){
			$user = JFactory::getUser();			
			$row =& JTable::getInstance("chronoforms_TextMsg_Form_5", "Table");
			srand((double)microtime()*10000);
			$inum	=	"I" . substr(base64_encode(md5(rand())), 0, 16);
			JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
			JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
			JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
			JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
			$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );			
			if (!$row->bind( $post )) {
				JError::raiseWarning(100, $row->getError());
			}				
			if (!$row->store()) {
				JError::raiseWarning(100, $row->getError());
			}
			global $row_jos_chronoforms_TextMsg_Form_5;
			$row_jos_chronoforms_TextMsg_Form_5 = $row;
		}
		?>
		


Thanks for your help
Max_admin 11 Nov, 2008
Good, one or more of your fields has a name with "-", replace it with _ then recreate the table and connect to the new one!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.