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 = "namet@reaganpower.com";

$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
Share on other sites

if ((!empty($textfield1)) && (!empty($textfield2))) {

 

$to = "namet@reaganpower.com";

$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
Share on other sites

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
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.