Jump to content

cpawebmaster

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cpawebmaster's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Of course I have seen the tutorials section, I also said, "it is similar to a tutorial so I don't know... just an idea." That FAQ snippet idea which I did not see sounds very similar.
  2. I was thinking more so that they would find a working (posted by the admin) version right away and try it out. Obviously for a specific detail problem they would just post in the respective section as usual. But if someone has a general problem and they are scrolling through the main forum page and see something catchy like General Knowledge Quick Answers they might check it out and not even have to post. And for my first post, the PHP Contact Form... there are so many different ways to make a working contact form, but that is one that will work for sure and is easily edited. That is a more advanced example though.
  3. Right, that makes sense. But I was thinking more centered on general knowledge or the top 20 most common problems. I guess that's kind of a tutorial idea really... I don't know just an idea!
  4. I didn't say it should be a sticky. It should have its own Forum Section. These "General Quick Answers" are only posted by admins with no replys. Examples could be, If IE Conditional Statements, Search Bar, CAPTCHA Box, and so on. Making these problems quick, easy, copy/paste, and to the point. I noticed the search function is not the greatest.
  5. Hello, I have a great idea. What if you had a forum section (maybe named "Quick Answers") with topics that answer the most common problems. For example, my post was about a PHP Contact Form and my question was resolved, so a post could be similar to: Topic Title: PHP Contact Form Message: * Fields Are Required (email, firstname, lastname, city, state, and message) Fill in the areas as needed... Edit at your own risk... Here is the PHP Code: <?php $mailto = 'your@email.com' ; $subject = "Your Contact Form" ; $formurl = "http://www.yoursite.com/contact.html" ; $errorurl = "http://www.yoursite.com/error.html" ; $thankyouurl = "http://www.yoursite.com/thankyou.html" ; $uself = 0; $use_sendmailfrom = 0; $use_webmaster_email_for_from = 0; $use_utf8 = 1; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ; if (isset( $use_sendmailfrom ) && $use_sendmailfrom) { ini_set( 'sendmail_from', $mailto ); } $firstname = addslashes($_POST['firstname']) ; $lastname = addslashes($_POST['lastname']) ; $city = addslashes($_POST['city']) ; $state = addslashes($_POST['state']) ; $phone = addslashes($_POST['phone']) ; $email = addslashes($_POST['email']) ; $website = addslashes($_POST['website']) ; $subject = addslashes($_POST['subject']) ; $message = addslashes($_POST['message']) ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } $valid_email = (preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/im', $email)) ? true : false; $valid_firstname = (!empty($firstname)) ? true : false; $valid_lastname = (!empty($lastname)) ? true : false; $valid_city = (!empty($city)) ? true : false; $valid_state = (!empty($state)) ? true : false; $valid_message = (!empty($subject) && !empty($message)) ? true : false; $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ; if (get_magic_quotes_gpc()) { $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); while (list($key, $val) = each($process)) { foreach ($val as $k => $v) { unset($process[$key][$k]); if (is_array($v)) { $process[$key][stripslashes($k)] = $v; $process[] = &$process[$key][stripslashes($k)]; } else { $process[$key][stripslashes($k)] = stripslashes($v); } } } unset($process); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "First Name: $firstname\n" . "Last Name: $lastname\n" . "City: $city\n" . "State: $state\n" . "Phone: $phone\n" . "Email: $email\n" . "Website: $website\n" . "Subject: $subject\n" . "------------------------- MESSAGE -------------------------\n\n" . $message . "\n\n------------------------------------------------------------\n" ; $headers = "From: \"$firstname\" <$fromemail>" . $headersep . "Reply-To: \"$firstname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" . $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ; if ($valid_email && $valid_firstname && $valid_lastname && $valid_city && $valid_state && $valid_message) { mail( $mailto, $subject, $messageproper, $headers ); } else { header( "Location: $errorurl" ); exit ; } header( "Location: $thankyouurl" ); exit ; ?> Here is the HTML Code: <div class="contactform"> <span style="font-size: 9pt; font-family: Verdana; color: #000000;"> <form action="contact.php" method="post"> <fieldset><legend><span style="font-size: 12px;"> CONTACT DETAILS </span></legend> <label for="firstname" class="left">First name:</label> <font color="#FF0000">*</font><input type="text" name="firstname" id="firstname" class="field" value="" maxlength="35" tabindex="1" /><br /><br /> <label for="lastname" class="left">Last name:</label> <font color="#FF0000">*</font><input type="text" name="lastname" id="lastname" class="field" value="" maxlength="35" tabindex="2" /><br /><br /> <label for="organization" class="left">Organization:</label> <font color="#FF0000"> </font><input type="text" name="organization" id="organization" class="field" value="" maxlength="45" tabindex="3" /><br /><br /> <label for="city" class="left">City:</label> <font color="#FF0000">*</font><input type="text" name="city" id="city" class="field" value="" maxlength="35" tabindex="4" /><br /><br /> <label for="state" class="left">State:</label> <font color="#FF0000">*</font><input type="text" name="state" id="state" class="field" value="" maxlength="2" tabindex="5" /><br /><br /> <label for="phone" class="left">Phone:</label> <font color="#FF0000"> </font><input type="text" name="phone" id="phone" class="field" value="" maxlength="10" tabindex="6" /><br /><br /> <label for="email" class="left">Email:</label> <font color="#FF0000">*</font><input type="text" name="email" id="email" class="field" value="" maxlength="50" tabindex="7" /><br /><br /> <label for="website" class="left">Website:</label> <font color="#FF0000"> </font><input type="text" name="website" id="website" class="field" value="" maxlength="60" tabindex="8" /><br /><br /> </fieldset> <fieldset><legend><span style="font-size: 12px;">MESSAGE DETAILS </span></legend> <label for="subject" class="left">Subject:</label> <font color="#FF0000">*</font><input type="text" name="subject" id="subject" class="field" value="" maxlength="35" tabindex="9" /><br /><br /> <label for="message" class="left">Message:</label> <font color="#FF0000"> </font><textarea name="message" id="message" cols="45" rows="10" maxlength="400" tabindex="10"></textarea><br /><br /> <input type="submit" name="submit" id="cpasubmit" class="button" value="Send Message" tabindex="11" /><br /><br /> </fieldset> </form> </span> </div> Just a GREAT idea! Thanks, CPAWebMaster - www.charityparade.org
  6. Also in IE the marquee scroll bar is not centered like in FF.
  7. Website: http://www.charityparade.org CSS: http://www.charityparade.org/style.css The problem is that the search bar in IE appears about 5 pixels lower than in FF. I've tried using top:5px; for the div with a separate css for IE with no success. An idea might be the <--[if IE]--> conditional statements which I tried but I think I did something wrong. If anyone has any ideas your help will be greatly appreciated. Thank you, CPAWebmaster - www.charitableprofitarrangement.org
  8. Finally, it works!!! Thank you so much! Here's the final code for anyone else making a form: <?php $mailto = 'your@email.com' ; $subject = "Your Contact Form" ; $formurl = "http://www.yoursite.com/contact.html" ; $errorurl = "http://www.yoursite.com/error.html" ; $thankyouurl = "http://www.yoursite.com/thankyou.html" ; $uself = 0; $use_sendmailfrom = 0; $use_webmaster_email_for_from = 0; $use_utf8 = 1; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ; if (isset( $use_sendmailfrom ) && $use_sendmailfrom) { ini_set( 'sendmail_from', $mailto ); } $firstname = addslashes($_POST['firstname']) ; $lastname = addslashes($_POST['lastname']) ; $city = addslashes($_POST['city']) ; $state = addslashes($_POST['state']) ; $phone = addslashes($_POST['phone']) ; $email = addslashes($_POST['email']) ; $website = addslashes($_POST['website']) ; $subject = addslashes($_POST['subject']) ; $message = addslashes($_POST['message']) ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } $valid_email = (preg_match('/^[A-Z0-9._%-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/im', $email)) ? true : false; $valid_firstname = (!empty($firstname)) ? true : false; $valid_lastname = (!empty($lastname)) ? true : false; $valid_city = (!empty($city)) ? true : false; $valid_state = (!empty($state)) ? true : false; $valid_message = (!empty($subject) && !empty($message)) ? true : false; $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ; if (get_magic_quotes_gpc()) { $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); while (list($key, $val) = each($process)) { foreach ($val as $k => $v) { unset($process[$key][$k]); if (is_array($v)) { $process[$key][stripslashes($k)] = $v; $process[] = &$process[$key][stripslashes($k)]; } else { $process[$key][stripslashes($k)] = stripslashes($v); } } } unset($process); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "First Name: $firstname\n" . "Last Name: $lastname\n" . "City: $city\n" . "State: $state\n" . "Phone: $phone\n" . "Email: $email\n" . "Website: $website\n" . "Subject: $subject\n" . "------------------------- MESSAGE -------------------------\n\n" . $message . "\n\n------------------------------------------------------------\n" ; $headers = "From: \"$firstname\" <$fromemail>" . $headersep . "Reply-To: \"$firstname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" . $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ; if ($valid_email && $valid_firstname && $valid_lastname && $valid_city && $valid_state && $valid_message) { mail( $mailto, $subject, $messageproper, $headers ); } else { header( "Location: $errorurl" ); exit ; } header( "Location: $thankyouurl" ); exit ; ?>
  9. I'm going to try that out, thank you for your help.
  10. Fixed that (duuuh, heh) but still sends to error page. This code works just fine but does not have all the fields I want checked and required. <?php $mailto = 'joseph@charitableprofitarrangement.org' ; $subject = "CPA Contact Form" ; $formurl = "http://www.charitableprofitarrangement.org/contact.html" ; $errorurl = "http://www.charitableprofitarrangement.org/error.html" ; $thankyouurl = "http://www.charitableprofitarrangement.org/thankyou.html" ; $email_is_required = 1; $name_is_required = 1; $comments_is_required = 1; $uself = 0; $use_envsender = 0; $use_sendmailfrom = 0; $use_webmaster_email_for_from = 0; $use_utf8 = 1; $my_recaptcha_private_key = '' ; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ; if (!isset( $use_envsender )) { $use_envsender = 0 ; } if (isset( $use_sendmailfrom ) && $use_sendmailfrom) { ini_set( 'sendmail_from', $mailto ); } $envsender = "-f$mailto" ; $fullname = (isset($_POST['fullname']))? $_POST['fullname'] : $_POST['name'] ; $email = $_POST['email'] ; $comments = $_POST['comments'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($comments_is_required && empty($comments))) { header( "Location: $errorurl" ); exit ; } if ( preg_match( "/[\r\n]/", $fullname ) || preg_match( "/[\r\n]/", $email ) ) { header( "Location: $errorurl" ); exit ; } if (strlen( $my_recaptcha_private_key )) { require_once( 'recaptchalib.php' ); $resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] ); if (!$resp->is_valid) { header( "Location: $errorurl" ); exit ; } } if (empty($email)) { $email = $mailto ; } $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ; if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name of sender: $fullname\n" . "Email of sender: $email\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; $headers = "From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" . $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ; if ($use_envsender) { mail($mailto, $subject, $messageproper, $headers, $envsender ); } else { mail($mailto, $subject, $messageproper, $headers ); } header( "Location: $thankyouurl" ); exit ; ?>
  11. Still sending to error page, updated code: <?php $mailto = 'joseph@charitableprofitarrangement.org' ; $subject = "CPA Contact Form" ; $formurl = "http://www.charitableprofitarrangement.org/contact.html" ; $errorurl = "http://www.charitableprofitarrangement.org/error.html" ; $thankyouurl = "http://www.charitableprofitarrangement.org/thankyou.html" ; $valid_points = 0; $uself = 0; $use_sendmailfrom = 0; $use_webmaster_email_for_from = 0; $use_utf8 = 1; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ; if (isset( $use_sendmailfrom ) && $use_sendmailfrom) { ini_set( 'sendmail_from', $mailto ); } $firstname = $_POST['firstname'] ; $lastname = $_POST['lastname'] ; $organization = $_POST['organization'] ; $city = $_POST['city'] ; $state = $_POST['state'] ; $phone = $_POST['phone'] ; $email = $_POST['email'] ; $website = $_POST['website'] ; $subject = $_POST['subject'] ; $message = $_POST['message'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (preg_match( '/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/im', $email)) $valid_points++ ; if (preg_match( '/[\r\n]/', $firstname)) $valid_points++ ; if (preg_match( '/[\r\n]/', $lastname)) $valid_points++ ; if (preg_match( '/[\r\n]/', $organization)) $valid_points++ ; if (preg_match( '/[\r\n]/', $city)) $valid_points++ ; if (preg_match( '/[\r\n]/', $state)) $valid_points++ ; if (preg_match( '/^\\d{10}$/m', $phone)) $valid_points++ ; if (preg_match( '/[\r\n]/', $website)) $valid_points++ ; if (preg_match( '/[\r\n]/', $subject)) $valid_points++ ; if (preg_match( '/[\r\n]/', $message)) $valid_points++ ; if (!empty($email)) $valid_points++ ; if (!empty($firstname)) $valid_points++ ; if (!empty($lastname)) $valid_points++ ; if (!empty($city)) $valid_points++ ; if (!empty($state)) $valid_points++ ; if (!empty($subject)) $valid_points++ ; if (!empty($message)) $valid_points++ ; if (empty($email)) { $email = $mailto ; } $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ; if (get_magic_quotes_gpc()) { $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); while (list($key, $val) = each($process)) { foreach ($val as $k => $v) { unset($process[$key][$k]); if (is_array($v)) { $process[$key][stripslashes($k)] = $v; $process[] = &$process[$key][stripslashes($k)]; } else { $process[$key][stripslashes($k)] = stripslashes($v); } } } unset($process); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "First Name: $firstname\n" . "Last Name: $lastname\n" . "Organization: $organization\n" . "City: $city\n" . "State: $state\n" . "Phone: $phone\n" . "Email: $email\n" . "Website: $website\n" . "Subject: $subject\n" . "------------------------- MESSAGE -------------------------\n\n" . $message . "\n\n------------------------------------------------------------\n" ; $headers = "From: \"$firstname\" <$fromemail>" . $headersep . "Reply-To: \"$firstname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" . $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ; if ($validpoints == 17) { mail( $mailto, $subject, $messageproper, $headers ); } else { header( "Location: $errorurl" ); exit ; } header( "Location: $thankyouurl" ); exit ; ?>
  12. woops sorry, thats: if (($validpoints == 17) && ($use_envsender)) { mail( $mailto, $subject, $messageproper, $headers, $envsender ); } else { header( "Location: $errorurl" ); exit ; }
  13. This is the new code: <?php $mailto = 'joseph@charitableprofitarrangement.org' ; $subject = "CPA Contact Form" ; $formurl = "http://www.charitableprofitarrangement.org/contact.html" ; $errorurl = "http://www.charitableprofitarrangement.org/error.html" ; $thankyouurl = "http://www.charitableprofitarrangement.org/thankyou.html" ; $valid_points = 0; $uself = 0; $use_envsender = 0; $use_sendmailfrom = 0; $use_webmaster_email_for_from = 0; $use_utf8 = 1; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ; if (isset( $use_sendmailfrom ) && $use_sendmailfrom) { ini_set( 'sendmail_from', $mailto ); } $envsender = "-f$mailto" ; $firstname = $_POST['firstname'] ; $lastname = $_POST['lastname'] ; $organization = $_POST['organization'] ; $city = $_POST['city'] ; $state = $_POST['state'] ; $phone = $_POST['phone'] ; $email = $_POST['email'] ; $website = $_POST['website'] ; $subject = $_POST['subject'] ; $message = $_POST['message'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (preg_match( "/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/im", $email )) $valid_points++ ; if (preg_match( "/[\r\n]/", $firstname )) $valid_points++ ; if (preg_match( "/[\r\n]/", $lastname )) $valid_points++ ; if (preg_match( "/[\r\n]/", $organization )) $valid_points++ ; if (preg_match( "/[\r\n]/", $city )) $valid_points++ ; if (preg_match( "/[\r\n]/", $state )) $valid_points++ ; if (preg_match( "/^\\d{10}$/m", $phone )) $valid_points++ ; if (preg_match( "/[\r\n]/", $website )) $valid_points++ ; if (preg_match( "/[\r\n]/", $subject )) $valid_points++ ; if (preg_match( "/[\r\n]/", $message)) $valid_points++ ; if (!empty($email)) $valid_points++ ; if (!empty($firstname)) $valid_points++ ; if (!empty($lastname)) $valid_points++ ; if (!empty($city)) $valid_points++ ; if (!empty($state)) $valid_points++ ; if (!empty($subject)) $valid_points++ ; if (!empty($message)) $valid_points++ ; if (empty($email)) { $email = $mailto ; } $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ; if (get_magic_quotes_gpc()) { $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); while (list($key, $val) = each($process)) { foreach ($val as $k => $v) { unset($process[$key][$k]); if (is_array($v)) { $process[$key][stripslashes($k)] = $v; $process[] = &$process[$key][stripslashes($k)]; } else { $process[$key][stripslashes($k)] = stripslashes($v); } } } unset($process); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "First Name: $firstname\n" . "Last Name: $lastname\n" . "Organization: $organization\n" . "City: $city\n" . "State: $state\n" . "Phone: $phone\n" . "Email: $email\n" . "Website: $website\n" . "Subject: $subject\n" . "------------------------- MESSAGE -------------------------\n\n" . $message . "\n\n------------------------------------------------------------\n" ; $headers = "From: \"$firstname\" <$fromemail>" . $headersep . "Reply-To: \"$firstname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" . $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ; if ($validpoints == 17) && ($use_envsender) { mail( $mailto, $subject, $messageproper, $headers, $envsender ); } else { header( "Location: $errorurl" ); exit ; } header( "Location: $thankyouurl" ); exit ; ?> I tried: if ($validpoints == 17) && ($use_envsender) { mail( $mailto, $subject, $messageproper, $headers, $envsender ); else { header( "Location: $errorurl" ); exit ; } } like you suggested but I got an error so I changed it to what you see as the new code. I am still getting the error page. I'm messing with the envsender and use_envsender strings but I do not know if they are connected and used properly. Please help!
  14. OK, let me try that out... does that phone code limit 10 characters from being typed on the form side or does it just record only first 10 char entered? Know what I mean, or do I use both what you suggested and maxlength="10" in contact.html?
  15. Extra question... Is this the correct code to check that (123abc@123abc.xyz) is used for email? ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$ or is this: ^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$ I am currently working on adding a check that the phone number is exactly 10 characters and is numbers only. If anyone has that on hand could you post it? I have this so far: ^[0-9 .-]+$ Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.