| | |
How to Omit the COMMENT text box...??
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2007
Posts: 22
Reputation:
Solved Threads: 0
Ok, Folks.... Just trying to clean up some free php code I recently garnered :-) It came complete with a COMMENTS box, yet I really don't need it. Can anyone show me what needs to be deleted in order for the PHP form to continue working properly? I tried deleting what I thought should be deleted yet I keep getting my ERROR.html page sent back to me. Of course, when I input some text in the COMMENTS area, the form submits properly, followed by the Thank You page.
I know how to take out the COMMENTS box in my HTML code, yet the PHP is not as easy. Any suggestions?
Keith/Zen!
I know how to take out the COMMENTS box in my HTML code, yet the PHP is not as easy. Any suggestions?
Keith/Zen!
I suspect there's somewhere that fetches the form parameter for the comment and if it's empty redirects the user to error.html
•
•
Join Date: Sep 2007
Posts: 22
Reputation:
Solved Threads: 0
Ok... if I'm doing this right, here's what I got as the code
There it is... Now, If I might ask... which parts of the code should I erase that will still allow the form to work minus the COMMENTS box? I do not want the COMMENTS box. Thanks!
Zen!
PHP Syntax (Toggle Plain Text)
$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $name = $_POST['name'] ; $email = $_POST['email'] ; $comments = $_POST['comments'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (empty($name) || empty($email) || empty($comments)) { header( "Location: $errorurl" ); exit ; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name of sender: $name\n" . "Email of sender: $email\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ;
There it is... Now, If I might ask... which parts of the code should I erase that will still allow the form to work minus the COMMENTS box? I do not want the COMMENTS box. Thanks!
Zen!
replace this one:
with:
php Syntax (Toggle Plain Text)
# $messageproper = # # "This message was sent from:\n" . # "$http_referrer\n" . # "------------------------------------------------------------\n" . # "Name of sender: $name\n" . # "Email of sender: $email\n" . # "------------------------- COMMENTS -------------------------\n\n" . # $comments . # "\n\n------------------------------------------------------------\n" ;
with:
php Syntax (Toggle Plain Text)
$messageproper ="";
PHP Syntax (Toggle Plain Text)
if (empty($name) || empty($email) || empty($comments)) { header( "Location: $errorurl" ); exit ; }
change the above code (starts on line 11) so that it looks like this:
PHP Syntax (Toggle Plain Text)
if (empty($name) || empty($email)) { header( "Location: $errorurl" ); exit ; }
that way, it won't require the comments to be filled anymore. If you want to allow the user to also leave the name and email fields blank, you can just get rid of that entire block of code.
![]() |
Similar Threads
- This Should be Easy for You Guys! (Linux Servers and Apache)
- not-a-virusadware (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: Connecting to MS Access with PHP
- Next Thread: please tell me what is wrong with the code?
| Thread Tools | Search this Thread |
apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions global google href htaccess html image include insert ip javascript joomla limit link list login mail mediawiki menu mlm msqli_multi_query multiple mycodeisbad mysql number oop parameter paypal pdf php phpincludeissue problem query radio random recourse recursion regex remote script search seo server sessions sms source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web webdesign white wordpress xml youtube







