[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 07-17-2008, 03:36 PM   #1 (permalink)
NamePros Member
 
Join Date: Apr 2008
Posts: 82
0.00 NP$ (Donate)

tanicos is an unknown quantity at this point


Question simple php form

Hello

Here is what i need to achieve. A php contact form with validation.

Name: ..... * mandatory
Email.... same thing
checkbox....not mandatory
and 1 multiple choice field with mandatory things (either 1 of them):
Do you want to buy this: yes no.
Now when they don't fill a field a pop-up must tell them to complete it and also when i receive the email i must see the fields name like:
Name....
Email... and so on.

thank you
tanicos is offline  
Old 07-17-2008, 04:56 PM   #2 (permalink)
Senior Member
 
nasaboy007's Avatar
 
Join Date: Jul 2005
Location: NJ
Posts: 1,112
1,454.30 NP$ (Donate)

nasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud ofnasaboy007 has much to be proud of


well i feel that spoonfeeding isn't useful, so i'll give you some starting points.

start with making the form in html, and making sure you have name= for each input.

then, in PHP, to call the input, use the variables $_POST['nameofinputgoeshere']. do some checks on them like if($_POST['username']=="") { echo "Fill in username"; }.

make sure you addslashes and strip_tags on the $_POST vars just to prevent injection.

once all the checkings done, use the mail function.


references to all these functions can be found on php.net.
nasaboy007 is offline  
Old 07-17-2008, 05:24 PM   #3 (permalink)
NamePros Legend
 
weblord's Avatar
 
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,840
21,700.43 NP$ (Donate)

weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness

Autism Protect Our Planet
just use the .php form i've uploaded from secondversion.com
it's contactbox.txt rename it to whatever you like make sure it's extension will be .php for it to run, replace my email there william[@]nabaza.com with your email address or an email address where you want the form field data to be sent to.

use the sample codes of javascript to validate your form field entries.
http://www.w3schools.com/js/js_form_validation.asp

HTH
Attached Files
File Type: txt contactbox.txt (933 Bytes, 4 views)
weblord is offline  
Old 07-18-2008, 06:31 AM   #4 (permalink)
NamePros Member
 
Join Date: Apr 2008
Posts: 82
0.00 NP$ (Donate)

tanicos is an unknown quantity at this point


thanks...i also need 2 mandatory checkboxes
tanicos is offline  
Closed Thread


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

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 02:21 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85