RE: [PHP] Form Processing problem....

From: Date: Wed, 18 Apr 2001 01:10:22 +0000
Subject: RE: [PHP] Form Processing problem....
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-49098@lists.php.net to get a copy of this message
I can't be sure without seeing everything, but you've most likely done everything correct except for the post-processing HTML output...in other words, if you're sending info to a php script, you have to output some HTML at the end of the processing that gives the correct HTML layout and says for instance "success"...or, as I often do, send the info to $PHP_SELF, and at the end of the mail and database calls print out the HTML skeleton with a success message...as it stands right now, it sounds like you're sending it to a script, and expecting it to go somewhere afterwards which is incorrect...you have to do something after you process the info... best of luck, jack -----Original Message----- From: Jack Lauman [mailto:jlauman@nwcascades.com] Sent: Tuesday, April 17, 2001 8:47 PM To: php-general Subject: [PHP] Form Processing problem.... I am calling the following php script from an HTML form with <form name="comment_form" method="post" action="php/comment_form.php"> In Internet Exploder 5.0 it processes the form, sends the message and commits to the database, but does not return to the referring page. In Netscape 4.77 it displays an error message the document contained no data even though it processes the form, sends the message and commits to the database. I would appreciate any insight on how to resolve this problem. Thanks, Jack <? $form_date = date("Y-m-d"); $form_time = date("H:i:s"); if (isset ($submit_form)) { // Define Mail Variables // $mailTo = "info@anydomain.com, $form_email"; $mailSubject = "Message Subject"; $mailHeaders = "From: $form_email"; $mailBody = "The following comment was submitted:\n\n"; $mailBody .= "Date: $form_date\n"; $mailBody .= "Time: $form_time\n\n"; $mailBody .= "By: $form_name\n"; $mailBody .= " $form_address1\n"; $mailBody .= " $form_address2\n"; $mailBody .= " $form_city, $state $zip\n"; $mailBody .= " $form_country\n\n"; $mailBody .= "E-mail: $form_email\n"; $mailBody .= "Phone: $form_phone\n\n"; $mailBody .= "$form_comments\n"; mail($mailTo, $mailSubject, $mailBody, $mailHeaders); // Connect to MySQL and store the collected information in the database. // mysql_connect( "localhost", "uid", "pwd"); $query = "INSERT INTO comments VALUES ('$form_id', '$form_date', '$form_time', '$form_name', '$form_address1', '$form_address2', '$form_city', '$form_state', '$form_zip', '$form_country', '$form_email', '$form_phone', '$form_comments')"; $result = mysql_db_query( "bbleisurepark", $query) OR die(mysql_error()); if ($result) { // Add success-error messages here.... } } ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#49098) next »