ilikephp Posted July 22, 2008 Share Posted July 22, 2008 Hello!! I have this form: <form method="post" action="sendmail.php"> <h4 align="left" class="red" dir="ltr"><strong>Name:</strong></h4> <p align="left" class="red" dir="ltr"> <input type="text" name="name" size="25" /> </p> <h4 align="left" class="red" dir="ltr"><strong>E-mail:</strong></h4> <p align="left" class="red" dir="ltr"> <input type="text" name="email" size="25" /> </p> <h4 align="left" class="red" dir="ltr"><strong>Message: </strong></h4> <p align="left" class="red" dir="ltr"> <textarea rows="3" name="message" cols="20"></textarea> </p> <p align="left" class="red" dir="ltr"> </p> <p align="left" class="red" dir="ltr"> <input name="B1" type="submit" class="readmore" value="SEND" /> </p> </form></td> How can I let the user enter name, e-mail and comments or a message will appear: You should enter name, email and comments? So the fields are required, because when they are empty, anyone can press send, and the empty msg will be sent. Thankyou Link to comment https://forums.phpfreaks.com/topic/115980-the-fields-are-required-in-sendmailphp/ Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 javascript Or PHP validation. for example: if($_POST['name'] == '') { echo "Name field should not be empty"; } and so on.... Link to comment https://forums.phpfreaks.com/topic/115980-the-fields-are-required-in-sendmailphp/#findComment-596295 Share on other sites More sharing options...
ilikephp Posted July 22, 2008 Author Share Posted July 22, 2008 Sry but where should I need to put it? Thanks... Link to comment https://forums.phpfreaks.com/topic/115980-the-fields-are-required-in-sendmailphp/#findComment-596299 Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 Do you have php code for your above html code. Link to comment https://forums.phpfreaks.com/topic/115980-the-fields-are-required-in-sendmailphp/#findComment-596302 Share on other sites More sharing options...
ilikephp Posted July 22, 2008 Author Share Posted July 22, 2008 the file is saved as .php and everything is HTML in it Link to comment https://forums.phpfreaks.com/topic/115980-the-fields-are-required-in-sendmailphp/#findComment-596305 Share on other sites More sharing options...
mmarif4u Posted July 22, 2008 Share Posted July 22, 2008 Can you post your whole code of that page. Link to comment https://forums.phpfreaks.com/topic/115980-the-fields-are-required-in-sendmailphp/#findComment-596307 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.