NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page simple php form

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

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 07-17-2008, 04:36 PM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Apr 2008
Posts: 104
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, 05:56 PM   #2 (permalink)
Senior Member
 
nasaboy007's Avatar
Join Date: Jul 2005
Location: NJ
Posts: 1,219
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 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, 06:24 PM   #3 (permalink)
NamePros Legend
 
weblord's Avatar
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,785
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)
__________________
Nabaza.com - Amaia
weblord is offline  
Old 07-18-2008, 07:31 AM THREAD STARTER               #4 (permalink)
NamePros Member
Join Date: Apr 2008
Posts: 104
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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 12:25 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger