|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
I'm having some trouble with a script for form mail, it generates it's own form.html and thankyou.html and the "post" references back to itself ("feedback.php").
This script works fine on a host where it does not have to be placed in an htdocs folder, but when in an htdocs folder it generates the form.html, but when "submit" is clicked it takes me back to a cleared form.html...? I have tried using the entire url..."http://www..../feedback.php" but it still doesn't work. On the host that it does work in, it will not worked when placed inside a folder...it apparently has to be on the root level. I did change the chmod to 755. any sugguestions, I'm still pretty new to .php... ![]() |
|
#2
|
|||
|
|||
|
That's weird... I haven't heard of anything like that before. Would you mind posting or attaching the code you're using?
Also, do the configurations from both servers differ at all?
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#3
|
|||
|
|||
|
Here's the script
Thanks...I still haven't figured this out yet. Here's the script and I've attached the brief install instructions.
<? /* CHFEEDBACK.PHP Feedback Form PHP Script Ver 1.01. Generated by thesitewizard.com's Feedback Form Wizard. Copyright (c) 2000 by Christopher Heng. All rights reserved. $Id: chfeedback0.txt 2.2 2002/07/11 07:43:47 chris Exp $ */ // *************** USER CONFIGURABLE SECTION ****************** // Before this script will do anything useful, the following // variables must be set. // MANDATORY VARIABLES // $sendto - email address where the feedback will be sent // eg, $sendto = "yourname@yourdomain.com" ; // $mainurl - the URL of your home page // eg $mainurl = "http://www.yourdomain.com/" ; // $subject - the subject line in the email sent by the feedback form // eg $subject = "Feedback Form" ; // OPTIONAL VARIABLES // $formurl - the URL of your feedback form (optional) // eg $formurl = "http://www.yourdomain.com/feedback.html" ; // $thankyouurl - the URL of your thank you page (optional) // eg $thankyouurl = "http://www.yourdomain.com/thanks.html" ; $sendto = 'you@yoursite.com'; $mainurl = "http://www.yoursite.com"; $subject = "Feedback Form"; $formurl = "http://www.yoursite.com/form.html"; $thankyouurl = "http://www.yoursite.com/thankyou.html"; // The following will allow you to change the text on the // Thank You page without having to draft a whole new page // (since thank you messages are pretty standard as they come). // This is OPTIONAL. Do not use this if you don't know what // you're doing. $thankyoumessage = "Thank you for your message. We appreciate \n" . "your taking the time to write to us.\n" ; $thankyoutitle = "Your Message Has Been Sent" ; // ************ END OF USER CONFIGURABLE SECTION *************** // ******************** MAIN FEEDBACK SCRIPT ***************** // Do not touch the following. You break it, you fix it. function disable_caching () { header( "Expires: Mon, 8 Dec 1999 05:00:00 GMT" ); header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" ); header( "Cache-Control: no-cache, must-revalidate" ); header( "Pragma: no-cache" ); } if (!isset( $email ) || !isset( $realname ) || !isset( $comments )) { if (empty( $formurl )) { // No customized Feedback Form was indicated by $formurl. // Use our default page. // DO NOT CHANGE THE FOLLOWING: If you want to // customize your feedback form, create a new file // and put its url in $formurl above. ?> <HTML> <head> <title>Feedback Form</title> </head> <body> <h1>Feedback Form</h1> <p> <form method="post" action="/feedback.php"> <table border=0 width="100%"> <tr> <td>Email address</td> <td><input type="text" name="email" size="25"></td> </tr> <tr> <td>Full name</td> <td><input type="text" name="realname" size="25"></td> </tr> <tr> <td valign="top"><br>Comments</td> <td><textarea name="comments" cols="25" rows=15></textarea><br> <br></td> </tr> <tr> <td> </td> <td> <input type="submit" value="Send comments"><br> <font size=1>Powered by <a href="http://www.thesitewizard.com/" target="_top">thesitewizard.com</a></font> </td> </tr> </table> </form> </p> <p> Or <a href="<?echo $mainurl?>">click here</a> to return to the main page. </p> <hr> This feedback script is copyright © 2000 by <a href="http://www.thesitewizard.com/" target="_top">Christopher Heng</a>. All rights reserved.<br> Get a feedback form and other CGI/PHP scripts for your website, free, at <a href="http://www.thesitewizard.com/" target="_top">thesitewizard.com</a>. </body> </html> <? exit ; } else { header( "Location: $formurl" ); exit ; } } if ((strlen($email) == 0)) { // No email address given - make up a dummy one. // This allows anonymous messages (which you can of course // ignore if you like). $email = "no_email_given" ; } // send the email now $messageproper = "This message was sent using from:\n" . " $HTTP_REFERER\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; mail($sendto, $subject, $messageproper, "From: \"$realname\" <$email>\nX-Sender: CHFEEDBACK.PHP" ); // display thank you message if (empty( $thankyouurl )) { // No customized thank you page was set in $thankyouurl. // Use our default. // DO NOT CHANGE THE FOLLOWING: If you want to // customize your feedback form, create a new file // and put its url in $formurl above. if (empty($thankyoutitle)) { $thankyoutitle = "Your Message Has Been Sent" ; } if (empty($thankyoumessage)) { $thankyoumessage = "Thank you for your message. We appreciate \n" . "your taking the time to write to us.\n" ; } disable_caching(); ?> <HTML> <head> <title><?echo $thankyoutitle?></title> </head> <body> <h1><?echo $thankyoutitle?></h1> <p> <?echo $thankyoumessage?> </p> <p> Please <a href="<?echo $mainurl?>">click here</a> to return to the main page. </p> <hr> This feedback script is copyright © 2000 by <a href="http://www.thesitewizard.com/" target="_top">Christopher Heng</a>. All rights reserved.<br> Get a feedback form and other CGI/PHP scripts for your website, free, at <a href="http://www.thesitewizard.com/" target="_top">thesitewizard.com</a>. </body> </html> <? } else { header ( "Location: $thankyouurl" ); } ?> Last edited by bcp1961 : November 9th, 2002 at 09:29 AM. |
|
#4
|
|||
|
|||
|
Are register_globals set to on or off (both servers)? I can't see why the one server requires the file to be in the root directory?
|
|
#5
|
|||
|
|||
|
Registered globals are set "on" on both of the servers.
Both servers are running PHP 4+. Putting the file in the root directory, and the top level of htdoc folder was necessary on both servers, otherwise I couldn't access it at all. I haven't seen anything written about that in any of the forums or tutorials I have come acrossed in trying to figure this out.... ![]() Last edited by bcp1961 : November 10th, 2002 at 04:52 PM. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Having trouble with form mail php and htdoc |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|