cluce Posted April 20, 2007 Share Posted April 20, 2007 hey guys, I am doing a submit form in DW 8 using php. Can someone please tell me how can I make these textfields to be required? Right now they can submit null values. Here is the code I am using. <?php $to = "[email protected]"; $subject = "Technical Support request form"; $body = " \n\n Name: $textfield \n\n E-Mail Address: $textfield2 \n\n Comments: $textarea"; mail ($to, $subject, $body); header("Location: http://reaganpower.com/thankyou.html"); ?> Link to comment https://forums.phpfreaks.com/topic/47933-solved-trying-to-make-textfields-to-be-required-before-submitting/ Share on other sites More sharing options...
jscix Posted April 20, 2007 Share Posted April 20, 2007 if ((!empty($textfield1)) && (!empty($textfield2))) { $to = "[email protected]"; $subject = "Technical Support request form"; $body = " \n\n Name: $textfield \n\n E-Mail Address: $textfield2 \n\n Comments: $textarea"; mail ($to, $subject, $body); header("Location: http://reaganpower.com/thankyou.html"); } else { print "Fill out all feilds etc etc"; } Link to comment https://forums.phpfreaks.com/topic/47933-solved-trying-to-make-textfields-to-be-required-before-submitting/#findComment-234265 Share on other sites More sharing options...
Fehnris Posted April 20, 2007 Share Posted April 20, 2007 If you want to check what they have entered before the form gets submitted you will have to use some form of client side script language ie. Javascript, VBscript to do the checking. I assume DW means Dreamweaver and I've not had any experience using it so I dont know what Client Side languages you can use with it. PHP is server side and so will not have the ability to check your form values before the form gets submitted. Link to comment https://forums.phpfreaks.com/topic/47933-solved-trying-to-make-textfields-to-be-required-before-submitting/#findComment-234292 Share on other sites More sharing options...
cluce Posted May 2, 2007 Author Share Posted May 2, 2007 oh ok thanks for your input. Javascript does work with Dreamweaver. Link to comment https://forums.phpfreaks.com/topic/47933-solved-trying-to-make-textfields-to-be-required-before-submitting/#findComment-243795 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.