By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 1,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

PHP else not working

P: 2
Here is my code, whenever i am testing if its false (I dont type in the from box it says message sent anyway?

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if (isset($_REQUEST['from']))
  3. {
  4. $from = $_REQUEST['from'];
  5. $to = $_REQUEST['to'];
  6. $subject = $_REQUEST['subject'];
  7. $message = $_REQUEST['message'];
  8. mail("$to", "$subject", $message, "From:".$from);
  9. echo "<div align='center'>Message sent!</div>";
  10. }
  11. else
  12. //Else show form again
  13. {
  14. echo "<form action='cheaposend.php' method='post'>
  15. From:<input type='text' name='from'/><br />
  16. To:<input type='text' name='to'/><br />
  17. Subject:<input type='text' name='subject'/><br />
  18. Message:<input colspan='60' height='30px' type='text' name='message'/><br/>
  19. <input type='submit'/>
  20. </form>";
  21. }
  22. ?>
I am using method="post" on other webpage
Nov 4 '11 #1
Share this Question
Share on Google+
3 Replies


zorgi
Expert 100+
P: 431
What method are you using get or post?

The form-data can be sent as URL variables (with method="get") or as HTTP post (with method="post").
Nov 4 '11 #2

P: 2
I am using method="post"
Nov 4 '11 #3

zorgi
Expert 100+
P: 431
Did that change help?
Nov 4 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.