How to post simple web form to email? please help

 
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
pschuch
-


Joined: 31 May 2005
Posts: 3

PostPosted: Tue May 31, 2005 10:27 am    Post subject: How to post simple web form to email? please help Reply with quote

I am new to Abyss X1 webserver - trying to post a simple web form to email. Does there exist any step by step instruction somewhere? Or can give me someone help on this.

Thank you much for your help !!!

Phil
Back to top View user's profile Send private message
richardyork
-


Joined: 22 Jun 2004
Posts: 411
Location: United Kingdom

PostPosted: Tue May 31, 2005 10:53 am    Post subject: Reply with quote

This will be ideal for you, I found it on the Internet some time ago now and I'v been using it ever since (I don't remember who's it is or where I got it from) It is a PHP script, so make sure you have PHP installed and set up correctly! Hope this helps you! Enjoy.....!

Code:

<?php

/* Hi pschuch here is the feedback form you asked for! Just edit it and save it as filename.php....easy! */
/* Edit this section */

$to = "user@domain.com"; // E-mail address the feedback is to be sent to
$subject = "Domain.ext Feedback"; // Subject of the e-mail that the feedback will be in
$afterpg = "page.htm"; // Page to be linked to after feedback is submitted (e.g. index.htm)

/* DO NOT EDIT BELOW THIS LINE (Unless you know what you are doing) */

error_reporting(1);

# Compliance check
if($to == "user@domain.com") {
print "Please ensure that you have editted this file, as it told you to!";
exit;
}

# Mail the result
if(isset($submit) && ($email) && ($message)) {
if (eregi("^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {
print "<br><center><font face='Tahoma' size='3'><b>Success! Your feedback was sent successfully - Thank-you.</b><br>Click <a href='".$afterpg."'>here</a> to continue...</font><br><br></center>";

mail($to, $subject, "$message

IP: $REMOTE_ADDR", "From: $email") or print "ERROR: Mail was not sent";
}
}
?>

<p align="center"><font size="4" face="Tahoma"><strong>Feedback</strong></font></p>

<form method="post" action="<?=$PHP_SELF;?>">
<font face="Tahoma" size="1">Your e-mail address:</font><br>
<input type="text" size="20" maxlength="72" name="email" value="<?=$email;?>"><?if(isset($submit) && (!$email)) {echo "&nbsp;<font face='Tahoma' size='1' color='#FF0000'><b>Enter your e-mail address</b></font>";} elseif (isset($submit) && !eregi("^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {echo "&nbsp;<font face='Tahoma' size='1' color='#FF0000'><b>Enter a valid e-mail address</b></font>";}?><br><br>
<font face="Tahoma" size="1">Your message:</font><br>
<textarea name="message" rows="6" cols="40"><?=$message;?></textarea><?if(isset($submit) && (!$message)) {echo "&nbsp;<font face='Tahoma' size='1' color='#FF0000'><b>Enter your message</b></font>";}?><br>
<p><input type="submit" name="submit" value="Send"></p>
</form>

_________________
Please SEARCH the forums BEFORE asking questions!
Back to top View user's profile Send private message
pschuch
-


Joined: 31 May 2005
Posts: 3

PostPosted: Tue May 31, 2005 4:45 pm    Post subject: Reply with quote

Hello richardyork
Thank you for your posting- this is what I am looking for.

I have tried to make the script run- but nothing happens.

What I have done:
- I have installed PHP as descriped under: http://www.aprelium.com/abyssws/php.html

- I have installed the php-5.0.4- installer from http://www.php.net/downloads.php

- I have edited your code provided with my email details and saved as feedback.php

- I can see the form in the browser, add information and press "Send"

->
- The page stays as is (gets blank again)

- I get the following log entry in the web server log:
127.0.0.1 - - [31/May/2005:17:31:45 +0200] "GET /feedback.php HTTP/1.1" 200 625 "" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"
127.0.0.1 - - [31/May/2005:17:31:58 +0200] "POST /feedback.php HTTP/1.1" 200 625 "http://www.mydomain.com/feedback.php" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)"


I would be glad if you could give me some ideas or tests to debug the setup. Maybe you see any error in the described process I have done.

Many thanks !!!!!

Phil
Back to top View user's profile Send private message
pschuch
-


Joined: 31 May 2005
Posts: 3

PostPosted: Tue May 31, 2005 5:46 pm    Post subject: Got it to work - Thank you ! Reply with quote

Hello richardyork

I got your script working! I have installed the php version 4.x. and after all was working.

Many Thanks!

Phil
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> General Questions All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group