Hello,
I have a simple form which I want to tie-in the username that the user already has in the registration process in Joomla.
Ex: Once they get to the home page, they already have a login created by the admin. Once they login, they will see a link which they can click on to fill-out a form. Once the form is filled-out, I want to include the Joomla username/date/time associated with that user in a table. (which the table already saves the form data I created, I'm just not sure how to get Joomla data)
Do I need php code to do this? Am I going about this wrong?
Thanks for your help!
I have a simple form which I want to tie-in the username that the user already has in the registration process in Joomla.
Ex: Once they get to the home page, they already have a login created by the admin. Once they login, they will see a link which they can click on to fill-out a form. Once the form is filled-out, I want to include the Joomla username/date/time associated with that user in a table. (which the table already saves the form data I created, I'm just not sure how to get Joomla data)
Do I need php code to do this? Am I going about this wrong?
Thanks for your help!
Hi ranger,
2 lines of PHP code will be needed, just tell me whats your Joomla and Chronoforms version so we can go on.
if you searched the forums for JFactory you will find many posts with the same or similar request and code.
Regards
Max
2 lines of PHP code will be needed, just tell me whats your Joomla and Chronoforms version so we can go on.
if you searched the forums for JFactory you will find many posts with the same or similar request and code.
Regards
Max
Hello Max,
Wow, the jfactory info in the forms fixed my problem. Thank you so much!
Ranger
Wow, the jfactory info in the forms fixed my problem. Thank you so much!
Ranger
No problems, that's great! could you please post your code for everybody reaches to this topic again ?🙂
only the snippet needed😉
Any more info on this? I cant find anything.... 😢
Hi MistaT2000,
Please search the forums on JFactory +getUser
Bob
[forumsb]JFactory +getUser[/forumsb]
Please search the forums on JFactory +getUser
Bob
[forumsb]JFactory +getUser[/forumsb]
Cheers Bob
I can get the username to appear now but for some reason Name wont appear???
My users have chosen funny usernames but I want their actual name to appear in the form results....
Here is my autogenerated code
Here is my form code:
I can get the username to appear now but for some reason Name wont appear???
My users have chosen funny usernames but I want their actual name to appear in the form results....
Here is my autogenerated code
<?php
global $database;
global $my;
srand((double)microtime()*10000);
$inum = "I" . substr(base64_encode(md5(rand())), 0, 16);
$database->setQuery( "INSERT INTO #__chronoforms_8 VALUES (
'' , '".$inum."','". date('Y-m-d')." - ".date("H:i:s")."', '".$_SERVER['REMOTE_ADDR']."' , '".mosGetParam($_POST,'date','')."' , '".mosGetParam($_POST,'Name','')."' , '".mosGetParam
($_POST,'UnderstandAgree','')."' , '".mosGetParam($_POST,'NoReasonWhy','')."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
Here is my form code:
<?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?".">"; ?><!DOCTYPE php PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<TITLE>Feedback Form</TITLE>
</head>
<!-- DO NOT change ANY of the php sections -->
<?php
global $my;
?>
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");?>
<input type="hidden" name="Name" value="<?php echo $my->Name; ?>" />
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
<input name="date" type="hidden" id="date" />
</font></strong></p>
<form method="post" action="Newsendemail.php" name="Form1" onSubmit="return validate_form ( );">
</p>
<table width="93%" height="320" border="0" cellpadding="1" cellspacing="4" bordercolor="#000000">
<tr bordercolor="#FFFFFF">
<td width="24%" height="21" align="left"><div align="center"><font face="Arial, Helvetica, sans-serif"><strong><font size="1" face="Arial, Helvetica, sans-serif"></font><font size="1">Â </font> <font size="1"></font></strong></font></div></td>
<td colspan="2" valign="top"><div align="left">
<p><font size="2" face="Arial, Helvetica, sans-serif"><strong>Have
you read and understood the IT Policies?</strong></font></p>
</div>
<tr>
<tr>
<td align="left"><font face="Arial, Helvetica, sans-serif"><strong><font size="1"> </font>
</strong>
</font>
<td width="60%"><strong><font size="1" face="Arial, Helvetica, sans-serif">
</font>
</strong>
<td width="12%">Â
<tr>
<td height="23" align="left"><font face="Arial, Helvetica, sans-serif"><strong><font face="Arial, Helvetica, sans-serif"><strong><font color="#000000" size="2">Have
you read and understood the
information?</font><font color="#000000" size="2" face="Arial, Helvetica, sans-serif">: </font> </strong> </font><font size="2"></font></strong></font>
<td><p><strong><font size="2"><font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif">
<select name="UnderstandAgree" size="1" id="UnderstandAgree">
<option>Please Select one of the options... </option>
<option value="Yes I have read and understand this information ">Yes
I have read and understand this information </option>
<option value="Yes I have read and understand this information ">No
I do not understand this information </option>
</select>
</font></font><font size="1" face="Arial, Helvetica, sans-serif"><a href="http://tinypic.com"><img src="http://i36.tinypic.com/amv1ci.gif" alt="Field Required" width="16" height="16" border="0" /></a></font> <font size="1" face="Arial, Helvetica, sans-serif"><a href="http://tinypic.com"><img src="http://i38.tinypic.com/5dnj7p.png" alt="Please select a value.." width="16" height="16" border="0" /></a></font><font size="2"><font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif"><br />
</font></font></strong><strong>
</strong>
</p>
<td><font size="2">Â <strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">
</font></strong> </font>
<tr>
<td height="34" align="left" valign="top"><font face="Arial, Helvetica, sans-serif"><strong></strong></font>
<td valign="top"><strong><font face="Arial, Helvetica, sans-serif"><strong><font color="#000000" size="2">If you do not understand the above information or you have any questions about
this then please <a href="blah@blah.com">email INF Communication</a></font></strong></font><font size="2"><a href="mailto:"><strong><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"> </font></strong></a></font> </strong>
<tr>
<td height="26" align="left" valign="top"><font color="#000000">Â
</font>
<td valign="top"><p>
<input type="submit" name="Submit" value="Submit Data" onsubmit="return validate_form ( );" />
<input type="reset" name="Submit2" value="Reset" />
<strong> <font size="2"><font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif">
</font></font></strong>
</p>
<tr>
<td height="100" align="left" valign="top"><p><font face="Arial, Helvetica, sans-serif"><strong></strong></font></p>
<td valign="top"><p><strong><font color="#FFFFFF" size="1" face="Arial, Helvetica, sans-serif"> </font> </strong>
</p>
<tr>
<td height="21" align="left" valign="top">Â
<td valign="top">Â <tr>
<td height="21" align="left">Â
</table>
<strong><font size="1" face="Arial, Helvetica, sans-serif">
</font></strong>
<p align="center">
<DIV ALIGN="CENTER">
</body>
Hi Mista,
this form code is wrong and iwll cause problems, remove the <form> tags and all code outside it except the necessary PHP code!
Regards
Max
this form code is wrong and iwll cause problems, remove the <form> tags and all code outside it except the necessary PHP code!
Regards
Max
This topic is locked and no more replies can be posted.