How to Omit the COMMENT text box...??

Reply

Join Date: Sep 2007
Posts: 22
Reputation: ZenMartian is an unknown quantity at this point 
Solved Threads: 0
ZenMartian ZenMartian is offline Offline
Newbie Poster

How to Omit the COMMENT text box...??

 
0
  #1
Feb 12th, 2008
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!
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 84
Reputation: johnsquibb is an unknown quantity at this point 
Solved Threads: 14
johnsquibb's Avatar
johnsquibb johnsquibb is offline Offline
Junior Poster in Training

Re: How to Omit the COMMENT text box...??

 
0
  #2
Feb 12th, 2008
any chance you can post the code?
Reply With Quote Quick reply to this message  
Join Date: Feb 2002
Posts: 12,040
Reputation: cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light cscgal is a glorious beacon of light 
Solved Threads: 125
Administrator
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: How to Omit the COMMENT text box...??

 
0
  #3
Feb 12th, 2008
I suspect there's somewhere that fetches the form parameter for the comment and if it's empty redirects the user to error.html
Dani the Computer Science Gal
Follow my Twitter feed! twitter.com/daniweb
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 22
Reputation: ZenMartian is an unknown quantity at this point 
Solved Threads: 0
ZenMartian ZenMartian is offline Offline
Newbie Poster

Re: How to Omit the COMMENT text box...??

 
0
  #4
Feb 12th, 2008
Originally Posted by johnsquibb View Post
any chance you can post the code?
Ok... if I'm doing this right, here's what I got as the code
  1. $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;
  2. $name = $_POST['name'] ;
  3. $email = $_POST['email'] ;
  4. $comments = $_POST['comments'] ;
  5. $http_referrer = getenv( "HTTP_REFERER" );
  6.  
  7. if (!isset($_POST['email'])) {
  8. header( "Location: $formurl" );
  9. exit ;
  10. }
  11. if (empty($name) || empty($email) || empty($comments)) {
  12. header( "Location: $errorurl" );
  13. exit ;
  14. }
  15. if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) {
  16. header( "Location: $errorurl" );
  17. exit ;
  18. }
  19.  
  20. if (get_magic_quotes_gpc()) {
  21. $comments = stripslashes( $comments );
  22. }
  23.  
  24. $messageproper =
  25.  
  26. "This message was sent from:\n" .
  27. "$http_referrer\n" .
  28. "------------------------------------------------------------\n" .
  29. "Name of sender: $name\n" .
  30. "Email of sender: $email\n" .
  31. "------------------------- COMMENTS -------------------------\n\n" .
  32. $comments .
  33. "\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!
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 561
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: How to Omit the COMMENT text box...??

 
0
  #5
Feb 12th, 2008
replace this one:

  1. #
  2. $messageproper =
  3. #
  4.  
  5. #
  6. "This message was sent from:\n" .
  7. #
  8. "$http_referrer\n" .
  9. #
  10. "------------------------------------------------------------\n" .
  11. #
  12. "Name of sender: $name\n" .
  13. #
  14. "Email of sender: $email\n" .
  15. #
  16. "------------------------- COMMENTS -------------------------\n\n" .
  17. #
  18. $comments .
  19. #
  20. "\n\n------------------------------------------------------------\n" ;

with:
  1. $messageproper ="";
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 84
Reputation: johnsquibb is an unknown quantity at this point 
Solved Threads: 14
johnsquibb's Avatar
johnsquibb johnsquibb is offline Offline
Junior Poster in Training

Re: How to Omit the COMMENT text box...??

 
0
  #6
Feb 12th, 2008
  1. if (empty($name) || empty($email) || empty($comments)) {
  2. header( "Location: $errorurl" );
  3. exit ;
  4. }


change the above code (starts on line 11) so that it looks like this:

  1. if (empty($name) || empty($email)) {
  2. header( "Location: $errorurl" );
  3. exit ;
  4. }

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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC