Join Form

7 posts by 3 authors in: Forums > CMS Builder
Last Post: November 12, 2010   (RSS)

By KCMedia - November 10, 2010

Hi

I have this issue with form that we are trying to push collected data to the cms builder database to store.

someone fills out the form and it will publish the data to the DB and also email the data, can get the get to email but not publish to the DB.

hope someone can help

thanks

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz
Attachments:

join.php 3K

mail.php 4K

Re: [kcmedia] Join Form

By Chris - November 10, 2010

Hi Craig,

The first thing I'd do would be to add error reporting to your mysql_query, like this:

mysql_query($sql) or die("MySQL Error:<br/>\n". htmlspecialchars(mysql_error()) . "\n");

That should help you figure out what's going wrong.

I hoep this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [kcmedia] Join Form

By Chris - November 11, 2010

Hi Craig,

You'll want to add that anywhere you call mysql_query, just to be on the safe side. In the attachments you posted, you're only calling mysql_query in mail.php on line 44.
All the best,
Chris

Re: [chris] Join Form

By KCMedia - November 11, 2010

Hi Chris

I have put that line in now and when i fill out the form this is the error i get

MySQL 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 '10:34 am, Friday, 12/11/10 10:34 am, Craig, kermond, kjkj, kjlkj, jlkj, craig@kc' at line 1

thanks

Craig
Thanks



Craig

KC Media Solutions

www.kcmedia.biz

Re: [kcmedia] Join Form

By Jason - November 12, 2010

Hi Craig,

It looks like a problem with how you're formatting the date. You can use the MySQL function NOW() to use the current server time stamp. Try using this SQL Query:

$sql = "INSERT INTO `cms_members SET
createdDate = NOW(),
updatedDate = NOW(),
createdByUserNum = 0,
updatedByUserNum = 0,

fname = '$fname',
lname = '$lname',
address = '$address',
suburb = '$suburb',
pcode = '$pcode',
email = '$email',
phone = '$phone',
source = '$source',
age = '$age'";


Give that a try and let me know if you still get an error.
Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Join Form

By Chris - November 12, 2010

You're going to want to escape those variables too, to prevent against SQL injection attacks!
All the best,
Chris