Dynadot โ€” .com Registration $8.99

Simple Php form

Spaceship Spaceship
Watch

tanicos

Established Member
Impact
0
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
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
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.
 
0
•••
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
 

Attachments

  • contactbox.txt
    933 bytes · Views: 48
0
•••
thanks...i also need 2 mandatory checkboxes
 
0
•••
Unstoppable Domains
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back