Current location: Hot Scripts Forums » Programming Languages » PHP » PHP Contact Form Question


PHP Contact Form Question

Reply
  #1 (permalink)  
Old 03-29-07, 12:45 PM
jdsmith8 jdsmith8 is offline
Newbie Coder
 
Join Date: Jul 2006
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Contact Form Question

I have a php contact form with many different choices. The form works fine, but I want to keep up with the data submitted.

Does anyone know what I need to keep a running tab of my options. For example I have one that says Task Performed with the options:

Tutoring
Mentoring
Administration
Volunteering

The php form submits to me fine, but I want to collect in a spreadsheet or database how many times Tutoring was chosen, how many times Mentoring was chosen, etc...

Any advice from the php pros out there?

Dave
Reply With Quote
  #2 (permalink)  
Old 03-29-07, 02:35 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
If you already have a database or if you don't have one and plan on getting one then your solution is simple.

In a database you could create a table with these fields:

Tutoring
Mentoring
Administration
Volunteering

Now every time the form is submitted you could update the database by adding one to the appropriate field. Then you can query the database to see the results.
__________________
Jerry Broughton
Reply With Quote
  #3 (permalink)  
Old 03-29-07, 03:03 PM
jdsmith8 jdsmith8 is offline
Newbie Coder
 
Join Date: Jul 2006
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
Database

Do I create a Sql database? Will it automatically keep count and then I query to see results or do I have to manually add the totals?

I am looking for an automatic way to do it and do not know how to create a database to store the results. Can you provide a link to some info on how to create that type of database?

Thanks
Reply With Quote
  #4 (permalink)  
Old 03-29-07, 05:58 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
A mySql database would be the easiest.
Do you have PHP with your hosting?
If you do then a program written in PHP would be rather simple to create.

Can you explain to me just what do you have so far?
Like a Domain and a hosting account w/PHP & mySql.
__________________
Jerry Broughton
Reply With Quote
  #5 (permalink)  
Old 03-29-07, 07:12 PM
jdsmith8 jdsmith8 is offline
Newbie Coder
 
Join Date: Jul 2006
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
I have php availability

How would I create a form to track the info on the form (rather simple):

http://www.eachonereachone.dreamhost...m/web-form.htm

I just want to be able to open a page a see the totals like: Tutoring 26 selections,
Mentoring 38 selections....

Just something that adds up the number of times the item has been selected and not have to keep up with it manually.

What if I want to be able to track all the information in the form (Name, Date, Hours, and the three categories at the bottom (tutor/mentor/administrative) in a database?

I have sqls also, but not on this site (but can move it to a server that has sql if php can not been done easily.

Thanks in advance for any help,
Dave
Reply With Quote
  #6 (permalink)  
Old 03-29-07, 07:46 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
Read my lips Code:
    Your form-send.php page is created in HTML only. To keep track of your traffic you would need PHP. Also a mySql dataBase would be nice but not totally necessary because you can use flat files instead. But in either case you need PHP or some other scripting language like ASP. I don't know much about ASP but I do know PHP. Do you have PHP with your hosting? If you don't than I can't help you.
__________________
Jerry Broughton
Reply With Quote
  #7 (permalink)  
Old 03-30-07, 07:13 AM
bizzar528's Avatar
bizzar528 bizzar528 is offline
Community Liaison
 
Join Date: Sep 2004
Location: Pennsylvania, US
Posts: 1,550
Thanks: 2
Thanked 16 Times in 15 Posts
wow Job, that was some useless posting there.

If the file name extension is .php, then he has php. And just because it shows up as html, doesn't mean the page is all html. html and php go hand in hand.

JD, the plan is that once your ready to mail the form output, add some php code that will dump the values to a flat text file. if you have php5 this can easily be done using the file_put_contents() function. If you only have php4, you'll need to read up on the fopen, fwrite, fclose functions. Either way, add a line to a file that will contain something this...

3|Value

Each time the form is submitted, have it write a line. Then, create a new .php file and have it parse the file and organize your information. I'd throw something together, but first work on getting the information dumped to a file, then move to the next step by building a reporting tool.
__________________
Yep, it's a signature...
Reply With Quote
  #8 (permalink)  
Old 03-30-07, 10:09 AM
jdsmith8 jdsmith8 is offline
Newbie Coder
 
Join Date: Jul 2006
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
wow - that is advanced

I have another form that I want to do the same thing stored at:

http://wellsremodeling.com/contact.php

Where can I find instructions on how to build a reporting page after each submission writes it in the text file?

Thanks in advance and remember I am a BABY. I do not even speak plain English, just aw cutie, cutie, boo, boo in code language references. :*)

Thanks in advance,
Dave
Reply With Quote
  #9 (permalink)  
Old 03-30-07, 03:35 PM
jdsmith8 jdsmith8 is offline
Newbie Coder
 
Join Date: Jul 2006
Posts: 89
Thanks: 0
Thanked 0 Times in 0 Posts
I have the data stored and can recall the data now

I have the data stored where I can view it at http://wellsremodeling.com/formresults.txt

but it just shows the data line by line. How can I make it add up the totals and show the Total times selected for each selection like:

DECKS 12 times
PAINTING 24 times

etc...

Thanks in advance,
Dave
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking for php mail form w/ attachments and required fields Sithlord999 Script Requests 0 08-11-06 04:14 AM
Question about a form mail script 9999 PHP 2 07-22-06 01:16 PM
PHP: Different table entry from same form? Stormrider Script Requests 3 05-07-05 08:19 AM
question on contact forum i built phpnut PHP 0 01-28-05 09:59 AM
general question about php and html timfoster PHP 3 05-17-04 12:29 PM


All times are GMT -5. The time now is 05:58 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.