Jump to content

[SOLVED] trying to make textfields to be required before submitting


cluce

Recommended Posts

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");

?>

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";

}

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.

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.