|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Looking for sample code
Hi,
I'm just getting started on PHP and I would like to read some sample code for form input + validation (javascript?), with email & db insertion on form submit. Thanks |
|
#2
|
|||
|
|||
|
RE: Looking for sample code
Hello Lovepoet,
I think I can help you with the JavaScript. I still have to learn the PHP for forms yet. <!--start JavaScript--> <SCRIPT> <!-- function validateform() { if(document.onlineform.first_name.value=="") { window.alert ("Please Enter Your First Name!"); document.onlineform.first_name.focus(); return false; } if(document.onlineform.middle_name.value=="") { window.alert ("Please Enter Your Middle Name!"); document.onlineform.middle_name.focus(); return false; } if(document.onlineform.last_name.value=="") { window.alert ("Please Enter your Last Name!"); document.onlineform.last_name.focus(); return false; } if (document.onlineform.street_address1.value=="") { window.alert ("Please Enter your Street Address!"); document.onlineform.street_address1.focus(); return false; } if (document.onlineform.City.value=="") { window.alert ("You have not entered your City!"); document.onlineform.City.focus(); return false; } if (document.onlineform.State.value=="") { window.alert ("Please Enter your State or Region!"); document.onlineform.State.focus(); return false; } if (document.onlineform.Country.value=="") { window.alert ("Please Specify what country you are from!"); document.onlineform.Country.focus(); return false; } } //--> </SCRIPT> <!--end JavaScript--> Ed Saratoga Springs, NY |
|
#3
|
|||||
|
|||||
|
RE: Looking for sample code
Lemme try this off the top of my head...
php Code:
I would normally make it more complex..like using a regexp to validate the email, etc... but I am in a hurry atm.... Cheers, Keith. |
|
#4
|
|||
|
|||
|
RE: Looking for sample code
Guys!
I do believe that between your two replies and 'Core PHP' I can jig something together. Many thanks! |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Looking for sample code |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|