Jump to content

New Forum Section - Quick Answers


Recommended Posts

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

Link to comment
Share on other sites

Even the "common" tasks that might be considered for a "pre-answered questions" style of forum vary enough that it would most likely be better to ask and answer the "same" question many times, specific to the needs of the asker. 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

As salathe said though, most problems vary enough for each user that a board like that wouldn't solve their problem. Heck some people post a PHP error clearly stating what the error is, with a line number, and still can't work it out.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

I was thinking more so that they would find a working (posted by the admin) version right away and try it out

 

That doesn't work because

 

1) Not everyone's contact form has the same requirements (or project specifics)

    Not everyone looks at a guestbook/contact form/forum the same way, IA and clients will teach you that.

2) Admin's will not do custom work to match your project requirements marking the tutorial obsolete for however copy-pasted it.

3) Admin's are busy enough they do not need to provide support for what they wrote

4) No-one uses the search apparently as your idea has already been suggested, which basically proves it.

5) There is already a tutorials section that can be found at http://www.phpfreaks.com (you probably didn't even knew there was such thing here)

6) If the admin's would write the code, the most people who copy-paste it will not be able to understand it (hence MrAdam's comments on error resolving)

 

Basically all these reasons are enough to not create such topic. However if you are convinced this is such a GREAT idea I recommend you start such a forum and provide such services and direct anyone who needs help to our freelance section (that will make our freelancers happy :D).

Link to comment
Share on other sites

[...]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.

 

Did you check our 'FAQ/Code Snippet Repository' section? Ever?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.