Forums

displaying results from a contact form

rnomis 03 Sep, 2008
Hi Guys,

I am using chronoforms 2.5 with the latest Joomla version.

I am trying to get a page that returns the results from a contact page as I don't want the client accessing the back end. The results from customer input are being emailed from the form ok.

I have worked through the tutorial but obviously have missed something vital!

The table includes the following fields: Name: and interest and for the moment, I want to just show these (I will add the rest when I get it working with those).

I have adapted the code from the tutorial as follows:
Body:
<p>

<strong>{Name:}</strong><br>

{Name:}

<br>

<maintext>

<br>
Interested in:

{interest}

</p>


For the moment, I have just entered the text 'Header' and '{pagination} Footer' in the relevant fields and in both Data View Field Names: and Data View Column titles, I have added: Name:,interest

I have not completed any other sections and have left the other options at their default values.

I saved the form and accessed the data from a completed form but get the following error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 SQL=SELECT count(*) FROMYou are not allowed to access this page!

SQL has always been a grey area for me so I am not sure where the problem lies.

Any help would be appreciated as once I get it working, I can write a tutorial for the community as I feel this would be a useful application for this module.
Any help in adding a check box on the page against each record with a 'Delete Record' button so the client can carry out basic maintenance would also be appreciated.

Thanks
Simon
jimwin 03 Sep, 2008
Hi there,

must be something simple. I'm a chrono newbie, and I found a basic page totally simple to set up!

My quick advice (until somebody clever picks this up!) is:
1) Check you have selected the correct TABLE from the droplist.
2) Leave the WHERE empty (at least at first).
3) Make sure you have your field values right. It is case sensitive, and needs { curly } brackets.

One thing though, do you really have a field called "name:" with the ":" on the end? Maybe SQL is getting confused with that?!?
Max_admin 03 Sep, 2008
Hi rnomis,

as Jim said, you have a severe problem, your field names will not have the ":" I believe, remove all your header and footer text, add this to body :

Name : {Name}


assuming your field name is "Name" and not "name", you should be very careful with this.

let me know!

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rnomis 03 Sep, 2008
Thanks Jim and Max.
I am now learning quickly!
I don't think the ':' at the end of the field names were a problem as it should behave just like any other letter. However, I rewrote the form and removed them. It also helped when I connected to the right table!
So, everything is working well so far.

All I need now is a bit of help with adding simple editing facilities to the front end page. What I would like is: A delete record and a delete all records option, a print record and print all records option and perhaps an edit record option and a send record as email option.
The table name is jos_chronoforms_2
the primary key is: cf_id
The other fields on the form are:
name
House_Name_No
Street,Post_Code
City
email_address
Daytime_Phone
Evening_Phone
Contact_me_by
interest
OtherInfo

If anyone can point me in the right direction, I would be very grateful and a tutorial will follow!

Thanks,
Simon
Max_admin 03 Sep, 2008
Hi Simon,

I'm sorry but having this now is not possible at all, please continue checking, I will try to add this feature into chronoconnectivity soon!🙂

Regards,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
rnomis 03 Sep, 2008
Hi Max
Thanks for the reply. Maybe someone else can help. In the mean time, I will look around for other options!
Regards
Simon
rnomis 05 Sep, 2008
Hi Max,
I am someway towards creating what I want but while my email records are displaying on the front end and I have a delete button which works with a stand alone script on my local machine, I am having problems with adding the code into ChronoConectivity.
the delete button shows but does not delete anything. Obvoiusly, having just cobbled together bits and pieces of code from various sources, I have a multitude of errors in my script.
i would be grateful if someone could point out my errors :-)
I don't get any errors on the page but it doesn't actually work either! I am sure this due to the code as I dont' know how (or even if) the ChronoConectivity code parenthesis can be used in my code.

The page url is:
http://premier4windows.co.uk/index.php?option=com_chronoconnectivity&Itemid=61
My code so far is:
<style type="text/css">
<!--
.layout {
	background-color: #EFBC8D;
	border: 1px solid #CC0000;
	margin: 2px;
	padding: 2px;
	width: 100%;
	float: none;
	display: block;
}
-->
</style>
<script language="jscript" type="text/javascript">
function Confirm()
{
confirm ("Are you sure you want to delete this record?");
}
</script>
<span class="layout">
<?

// Get all records in all columns from table and put it in $result.
$result=mysql_query("select * from jos_chronoforms_2");

/*Split records in $result by table rows and put them in $row.
Make it looping by while statement. */
//while($row=mysql_fetch_assoc($result))
{
// Do delete statement.
mysql_query("delete from from jos_chronoforms_2 where id='$cf_id'");
// Output
echo("ID: "). $row['cf_id']."<br>";
echo("Name: "). $row['name']."<br>";
echo("email: "). $row['email_address']."<br>";
echo("Phone: "). $row['Daytime_Phone']."<br>";


?>
 
<strong>Contact Name: {name}</strong><br>
ID: {cf_id}<br>
<strong>Address: </strong>{House_Name_No}, {Street}<br>
{City}. {Post_Code}<br>
<strong>email address:</strong> {email_address}<br>
Daytime: {Daytime_Phone}<br>
Evening: {Evening_Phone}<br>
Interested in: {interest}. Please contact me by:
{Contact_me_by}<br>
<strong>Other Information:</strong> {OtherInfo}
</p>

<?
// Add a link with a parameter(id) and it's value. This for deleting a record
echo $row['cf_id'].'<input type="submit" name="Delete" value="Delete Record" onclick="return Confirm();"
style="cursor:hand; color:000000; background-color:cccccc;"><br>';
}

?>
<hr></span><br>


Any help from someone would be great.

Thanks

Simon
Max_admin 05 Sep, 2008
Hi Simon,

I don't suggest the way you have it now, I suggest using Joomla's api to interact with the database, you can do this, beside each record add a link called delete, the link will be as the current connection link but add to it : &action=delete&rowid={id} I assume your table primary key is id, simply by clicking this link now you will go to your connection page, the same as you are, because action=delete is meaningless to the connection, so go to your connection header, and add a SQL query to delete record and use the JRequest::getVar('rowid') to get your row id, the query syntax can be found if you searched the forums for delete, let me know if you did that and it didn't work!

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.