Jump to content

help with feedback form !


janmejay

Recommended Posts

Hey guys, really sorry to ask as I'm sure its an irritatingly frequent query but I'm struggling with a feedback form.

 

I want to customize the feedback form as I have multiple receipients. Can this be done with a single combination of index.html and a corresponding php script behind ? I want whichever receipient selected on the form, mail should go to him and a cc or bcc to web administrator.

 

Here is my index.html

----------------------

<a href="feedback1.html" title="Email Mei" style="text-decoration:none"><u>Email Me</u>

 

Clicking on this on a web-page leads to another page which actually displays form coming from html source as below

---------------------------------------------

 

<table border="1" cellpadding="10" bordercolor="brown" style="text-align:justify">

</center>

<form action="feedback1.php" method="post">

<table border="0" cellpadding="8" cellspacing="8" summary="feedback form">

 

<tr><td>Name:</td><td><input type="text" name="name" size="25" /></td></tr>

<tr><td>From:</td><td><input type="text" name="from" size="25" /></td></tr>

<tr><td>Email address:</td><td><input type="text" name="email" size="25" /></td></tr>

<tr>

<td colspan="2">

Comments<br />

<textarea rows="15" cols="45" name="comments"></textarea>

</td>

</tr>

<tr>

<td align="center" colspan="2">

<input type="submit" value="Send Feedback" /><br />

</td>

</tr>

</table>

</form>

</table>

 

Once clicked on this send feedback, php code on the server takes care which is as below

---------------------------------------------

 

<?

// ------------- CONFIGURABLE SECTION ------------------------

 

 

$mailto = 'web_administrator@mail.com' ;

 

$subject = "Message from MyWebsite.com" ;

 

$formurl = "http://www.mywebsite.com" ;

$errorurl = "http://www.mywebsite.com/error.html" ;

$thankyouurl = "http://www.mywebsite.com/thankyou.html" ;

 

$uself = 1;

 

// -------------------- END OF CONFIGURABLE SECTION ---------------

 

$headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ;

$name = $_POST['name'] ;

 

$from = $_POST['from'] ;

 

$email = $_POST['email'] ;

$comments = $_POST['comments'] ;

$http_referrer = getenv( "HTTP_REFERER" );

 

if (!isset($_POST['email'])) {

header( "Location: $formurl" );

exit ;

}

if (empty($name) || empty($from) || 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" .

"From: $from\n" .

"Email : $email\n" .

"------------------------- COMMENTS -------------------------\n\n" .

$comments .

"\n\n------------------------------------------------------------\n" ;

 

mail($mailto, $subject, $messageproper,

"From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" );

header( "Location: $thankyouurl" );

exit ;

 

?>

==============================================

 

Now my requirement is - there are multiple receipients spread across different places. Web visitor chooses to send an email to a receipient nearest to his/her location. So, as you have seen above feedback1.html for first receipient. I have multiple files like this. Based on whichever receipent's "Email Me" is clicked either feedback1.html or feedback2.html or feedback3.html etc gets called and there are correspond feedback1.php, feedback2.php and feedback3.php etc. Now as receipients are increasing, maintaining and managing these files is becoming difficult.

 

Can I have just one feedback.html & feedback.php and whichever receipient is selected by visitor, that receipeient will get email and I don't have to maintain so many feedback.html's and feedback.php's. Can it be done in a if-else loop or any other means? And if so, how?

 

Also, with each receipient receiving a mail from visitor, can I have a feature that it sends a cc or bcc to webmaster too?

 

Thanks for your time and support on this.

best regards,

janmejay

 

 

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.