| | |
Please Read! php problem.
Thread Solved |
•
•
Join Date: Jul 2009
Posts: 43
Reputation:
Solved Threads: 0
I'm just new in php actually and this is the problem that i have been encountering lately. I actually have one .html file and .php file, on the .html file I created a form which looks like this:
And here is the .php file:
The problem that i'm encountering here is, in each textbox in the.html file i just live it blank, once that i click on the "Submit" button, the output that would be displayed is "Message sent.", instead of "Sending failed, please input the required fields."
Please help me here.. Thanks, been trying to solve it for almost 6hours already, and still i get the same output.
thanks in advance.
PHP Syntax (Toggle Plain Text)
<table cellpadding="0" cellspacing="5" border="0" width="500" align="center"> <form name="FAQ" method="post" action="question.php"> <span style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;font-style: normal;line-height: normal;font-weight: normal;font-variant: normal;text-transform: none;color: #000000;"> <tr> <td width="150"><p class="content">Name: * </td> <td width="350"><input type="text" size="55" name="name"></td> </tr> <tr> <td width="150"><p class="content">Email Address: * </td> <td width="350"><input type="text" size="55" name="email"></td> </tr> <tr> <td width="150"><p class="content">Question: * </td> </tr> <tr> <td width="350" colspan="2"><textarea cols="59" rows="5"></textarea name="question"></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" value="Submit" name="submit"></td> </tr> <tr> <td> </td> </tr> </form> </table>
And here is the .php file:
PHP Syntax (Toggle Plain Text)
<?php if (isset($_POST["submit"])) { $name = $_POST['name']; $email = $_POST['email']; $question = $_POST['question']; $message = "Message from $name \n Message: $question"; mail($email,Inquiry,$message); echo "Message sent."; } else { echo "Sending failed, please input the required fields."; } ?>
The problem that i'm encountering here is, in each textbox in the.html file i just live it blank, once that i click on the "Submit" button, the output that would be displayed is "Message sent.", instead of "Sending failed, please input the required fields."
Please help me here.. Thanks, been trying to solve it for almost 6hours already, and still i get the same output.
thanks in advance.
Last edited by JerieLsky; Sep 14th, 2009 at 7:40 am.
•
•
Join Date: Jul 2007
Posts: 77
Reputation:
Solved Threads: 5
you should have check first if the fields are not empty?
For now, you might already get the idea. Hope it helps
PHP Syntax (Toggle Plain Text)
<?php // you should check if this fields are empty if($_POST['name']=="" || $_POST['email']=="" || $_POST['question']=="") { echo "Sending failed, please input the required fields."; }else{ $name = $_POST['name']; $email = $_POST['email']; $question = $_POST['question']; $message = "Message from $name \n Message: $question"; if(mail($email,Inquiry,$message)) echo "Message sent."; else echo "Message sending failed"; }
For now, you might already get the idea. Hope it helps
•
•
Join Date: Jul 2007
Posts: 77
Reputation:
Solved Threads: 5
the problem is, this part
try changing it to this
and use the code that i've given earlier
PHP Syntax (Toggle Plain Text)
<td width="350" colspan="2"><textarea cols="59" rows="5"></textarea name="question"></td>
try changing it to this
PHP Syntax (Toggle Plain Text)
<td width="350" colspan="2"><textarea cols="59" rows="5" name="question"></textarea></td>
and use the code that i've given earlier
Last edited by ivatanako; Sep 14th, 2009 at 8:58 am.
•
•
Join Date: Jul 2009
Posts: 43
Reputation:
Solved Threads: 0
Seriously, still no output. I even tried adding this statement in the .php file it actually showed nothing. I added that statement after the <?php tag and before the if-else statement, here:
so confusing..
PHP Syntax (Toggle Plain Text)
echo "Me";
PHP Syntax (Toggle Plain Text)
<?php echo "Me"; if($_POST['name']=="" || $_POST['email']=="" || $_POST['question']=="") { echo "Sending failed, please input the required fields."; } else { $name = $_POST['name']; $email = $_POST['email']; $question = $_POST['question']; $message = "Message from $name \n Message: $question"; if(mail($email,Inquiry,$message)) echo "Message sent."; else echo "Message sending failed"; } ?>
so confusing..
•
•
Join Date: Jul 2007
Posts: 77
Reputation:
Solved Threads: 5
•
•
•
•
Seriously, still no output. I even tried adding this statement in the .php fileit actually showed nothing. I added that statement after the <?php tag and before the if-else statement, here:PHP Syntax (Toggle Plain Text)
echo "Me";PHP Syntax (Toggle Plain Text)
<?php echo "Me"; if($_POST['name']=="" || $_POST['email']=="" || $_POST['question']=="") { echo "Sending failed, please input the required fields."; } else { $name = $_POST['name']; $email = $_POST['email']; $question = $_POST['question']; $message = "Message from $name \n Message: $question"; if(mail($email,Inquiry,$message)) echo "Message sent."; else echo "Message sending failed"; } ?>
so confusing..
do you have a mailserver? i tested your code on my machine.. and im sure that it is working.
try removing the mail function then try outputting just plain text
•
•
Join Date: Jul 2007
Posts: 77
Reputation:
Solved Threads: 5
PHP Syntax (Toggle Plain Text)
if(mail($email,Inquiry,$message))
try changing the 'inquiry'
Last edited by ivatanako; Sep 14th, 2009 at 9:33 am.
•
•
Join Date: Jul 2009
Posts: 43
Reputation:
Solved Threads: 0
this is what i did in the .php file, i omitted the contents and i just replaced it with this statement but still no output:
what do u think is causing the problem?
PHP Syntax (Toggle Plain Text)
<?php echo "Me."; ?>
what do u think is causing the problem?
![]() |
Similar Threads
- PHP RSS Reader Outputting Hebrew Problem (PHP)
- How to Read PDf File Using php (PHP)
- php problem (PHP)
- Help - php problem! (PHP)
- php value problem (PHP)
- Learning PHP but problem with script (PHP)
- emails sent to bulk folder....(Is this a php problem?) (PHP)
- 'can't read from drive c' problem (Storage)
- Large Array Problem (PHP)
Other Threads in the PHP Forum
- Previous Thread: echo google problem
- Next Thread: php Error: 403 Forbidden
Views: 794 | Replies: 21
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array auto box broken buttons cakephp check checkbox class cms code combobox curl database date directory display download dropdown dropdownlist drupal dynamic echo email error file files form forms functions header href htaccess html image include insert integration ip java javascript joomla jquery limit link list login loop mail menu methods mlm mod_rewrite multiple mysql order output parse password paypal pdf php problem query radio random recursion redirect regex remote rows script search select server session sort source sql string structure syntax table update upload url user validation variable video web website wordpress xml zend





