| | |
Please Read! php problem.
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
php forms can be self processing, its easy to debug one script, try but the message is only being sent to the sender, no address is specified for you
Try replacing line 16 message to "customer service", copy to sender
all necessary html headers are sent before any script output, in case malformed pages are being thrown out by the server,
php Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- @(#) $Id$ --> <head> <title>HTML Template</title> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> </head> <body> <?php if (isset($_POST["submit"])) { if(!$_POST['name'] || !$_POST['email'] || !$_POST['question'] ) { echo "Required fields not completed, please input the required fields."; } else { $name = $_POST['name']; $email = $_POST['email']; $question = $_POST['question']; $message = wordwrap("Message from $name \n Message: $question", 70); if(!mail($email,"Inquiry",$message)) {echo "Sending failed, please input the required fields."; } else echo "Message sent."; } } ?> <form name='FAQ' method='post' action='<?php echo $_SERVER["PHP_SELF"]; ?>'> <table cellpadding='0' cellspacing='5' border='0' width='500' align='center'> <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' name='question'></textarea></td> </tr> <tr> <td colspan='2' align='right'><input type='submit' value='Submit' name='submit'></td> </tr> </table> </form> </body> </html>
Try replacing line 16
php Syntax (Toggle Plain Text)
if(!mail('myaddress@mysite.com',"Inquiry",$message,"Cc:$email\r\n")) {echo "Sending failed, please input the required fields."; } else echo "Message sent.";
all necessary html headers are sent before any script output, in case malformed pages are being thrown out by the server,
Last edited by almostbob; Sep 14th, 2009 at 11:15 am.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Jul 2007
Posts: 77
Reputation:
Solved Threads: 5
•
•
•
•
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:
PHP Syntax (Toggle Plain Text)
<?php echo "Me."; ?>
what do u think is causing the problem?
this is a better line16
php Syntax (Toggle Plain Text)
if(!mail('me@mysite.com',"Inquiry","$message","From: $email " . "\r\n" . "Cc: $email"."\r\n")) {echo "Sending failed,"; } else { echo "Message sent."; }
Last edited by almostbob; Sep 14th, 2009 at 12:36 pm.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
try this:
This worked on my server. Tested!
PHP Syntax (Toggle Plain Text)
<?php //The button is presed if (isset($_POST["submit"])) { $name = $_POST['name']; $email = $_POST['email']; $question = $_POST['question']; $message = "Message from $name \n Message: $question"; $sent_mail = mail($email,$message,$message); if($sent_mail) { echo "Message sent."; die();//Stop here } else { "Message was NOT Sent."; die(); } } else { ?> <table cellpadding="0" cellspacing="5" border="0" width="500" align="center"> <form name="FAQ" method="post" action="mail.php"> <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 name="question" cols="59" rows="5"></textarea></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" value="Submit" name="submit"></td> </tr> <tr> <td> </td> </tr> </form> </table> <?php } ?>
This worked on my server. Tested!
•
•
Join Date: Jul 2009
Posts: 41
Reputation:
Solved Threads: 0
Hi there almostbob, thanks for the quick response.. well actually i'm still having a problem with one line that you've give which is in line 18 stating:
The problem is in the action='<?php echo $_SERVER["PHP_SELF"]; ?>'
Once that i click the Submit button a "Page Load Error" occurs saying
"Firefox can't find the file at /C:/Documents and Settings/rEd_xiii21/Desktop/programming/ERDI Website Final/Duplicate of Edited Site/<?php echo $_SERVER["PHP_SELF"]; ?>."
What does the code - action='<?php echo $_SERVER["PHP_SELF"]; ?>' - actually do?
Thanks for your time.
PHP Syntax (Toggle Plain Text)
<form name='FAQ' method='post' action='<?php echo $_SERVER["PHP_SELF"]; ?>'>
The problem is in the action='<?php echo $_SERVER["PHP_SELF"]; ?>'
Once that i click the Submit button a "Page Load Error" occurs saying
"Firefox can't find the file at /C:/Documents and Settings/rEd_xiii21/Desktop/programming/ERDI Website Final/Duplicate of Edited Site/<?php echo $_SERVER["PHP_SELF"]; ?>."
What does the code - action='<?php echo $_SERVER["PHP_SELF"]; ?>' - actually do?
Thanks for your time.
•
•
Join Date: Jul 2009
Posts: 41
Reputation:
Solved Threads: 0
Here is a link to download the .html and .php file that i'm working with.
http://www.adrive.com/public/c510468...5e82f624c.html
Ahm, i'm actuallly using wamp server, I've set them ONLINE and started all services too.. so I think I don't have a problem with it though.
http://www.adrive.com/public/c510468...5e82f624c.html
Ahm, i'm actuallly using wamp server, I've set them ONLINE and started all services too.. so I think I don't have a problem with it though.
•
•
Join Date: Jul 2007
Posts: 77
Reputation:
Solved Threads: 5
•
•
•
•
Here is a link to download the .html and .php file that i'm working with.
http://www.adrive.com/public/c510468...5e82f624c.html
Ahm, i'm actuallly using wamp server, I've set them ONLINE and started all services too.. so I think I don't have a problem with it though.
Have you put your files in the WWW directory?? in wamp by default, it is located here C:\wamp\www\
then try accessing it like this
http://localhost/E-FAQ.html
you are trying to run php from the local file system /C:/Documents and Settings/rEd_xiii21/Desktop/programming/ERDI Website Final/Duplicate of Edited Site/
that wont work, even if it is the same folder
php has to run as http://127.0.0.1/filepath/filename.php (or localhost/)
move all the files you wish to work on, below the folder assigned as localhost in your php/wamp/IDE settings and access them though the localhost url
I do not know what php system version/wamp/ide you have installed but the errors now seem to be simply method problems, but a solution is getting closer (nervous fingers crossed)
that wont work, even if it is the same folder
php has to run as http://127.0.0.1/filepath/filename.php (or localhost/)
move all the files you wish to work on, below the folder assigned as localhost in your php/wamp/IDE settings and access them though the localhost url
I do not know what php system version/wamp/ide you have installed but the errors now seem to be simply method problems, but a solution is getting closer (nervous fingers crossed)
Last edited by almostbob; Sep 14th, 2009 at 11:07 pm.
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
![]() |
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
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner binary body broken cakephp checkbox class cms code cron curl database date date/time directory display download dynamic echo email error file files folder form forms function functions global google href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail menu mlm mod_rewrite msqli_multi_query multiple mycodeisbad mysql oop parameter paypal pdf php problem query radio random recourse recursion regex registrationform remote script search seo server sessions sms soap source space sql static syntax system table tutorial update upload url validation validator variable video web webdesign wordpress xml youtube






