• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

"Contact Us" form posting to a SQL server

Scarpozzi

Lifer
I've been charged with creating a website for a friend that's going to be pretty big. The deal is that we're wanting a customer contact form so they can enter in their address and submit a text box with their needs. Pretty simple stuff.

I've never programmed php or tried to interface it with tables in a SQL database. Most of the things I've read online are either way out of date or they cover posting to a local SQL database rather than connecting to a SQL server via TCP/IP. Here are my questions:


1. What are all the pieces I'm going to need to make this work?
Example: HTML webpage, PHP code, SQL server, any drivers to make them work together....
2. What's a good online resource for this?

Thanks.
 
Originally posted by: Scarpozzi
1. What are all the pieces I'm going to need to make this work?
Example: HTML webpage, PHP code, SQL server, any drivers to make them work together....

- an HTML webpage with an HTML form on it and the action attribute pointing to your php page.

- a form processing php page which organizes the data and updates the SQL database.

- an SQL database.

You don't need to worry about drivers and installations and stuff like that - your hosting company will have it all set up for you.

2. What's a good online resource for this?

Honestly, anywhere... form processing is what PHP is made for.

Most of the things I've read online are either way out of date or they cover posting to a local SQL database rather than connecting to a SQL server via TCP/IP.

It is no more difficult to connect to a remote DB than a local one. The appropriate code can be found in the PHP docs or on just about any web programming site or forum.
 
Originally posted by: snapper316
who is the hosting company?

They more than likely offer free mySQL db's and more than likely offer PHP
If you want to store and use the data later:
http://www.freewebmasterhelp.com/tutorials/phpmysql


Or some hosting companies offer a free e-mail script that would email them(your friend) the form(the customers) information
Yes...the hosting co. has both php and mySQL support.... I'm trying to stay away from email forms. I don't want to worry so much about potential security issues from spam-bot attacks...

I'll check that link in a little bit. It looks like it might be exactly what I need. Thanks.
 
Thanks Atheus. That's pretty much what I thought. I've used php bulletin board software, so I know you can connect to external DBs, etc... Since all of it resides on the same web host, I'm going to have to figure out how exactly they set it up. I do better when I'm staring at the physical hardware rather than doing everything remotely.
 
phpMyAdmin will make it much easier to create the tables using the interface rather than code also can find that on your control panel
 
Originally posted by: snapper316
phpMyAdmin will make it much easier to create the tables using the interface rather than code also can find that on your control panel
That's how I created them... I do a lot of stuff with mySQL at work. Everything I do though is with Tomcat/JBOSS applications that all give me nice fields to configure the connection to my database servers....or they're auto configured at the time of install.

This is my first time trying to write code that connects to a remote db. I'll probably dive into this project tonight or this weekend.
 
Spam Mail and the inability to manipulate the data further w/o re-entry are two good reasons to avoid Form Mails.

Sounds like you'll be fine scarpozzi, I used that tutorial about 2 years ago when first picking up PHP, pretty straightforward/simple.
 
Originally posted by: snapper316
Spam Mail and the inability to manipulate the data further w/o re-entry are two good reasons to avoid Form Mails.

Sounds like you'll be fine scarpozzi, I used that tutorial about 2 years ago when first picking up PHP, pretty straightforward/simple.
Exactly...Spam bots are one reason I'm avoiding that. The other reason is because this site will potentially get 200,000 hits next month alone. I need to have something decent to capture some data and be able to export it somewhere useful.
 
Back
Top