Click to See Complete Forum and Search --> : [RESOLVED] Basic Form Question
amberfrances
07-18-2007, 01:06 PM
Hello there, i want to put a form on my contact page where the submit button sends the input to my email. Can somebody help me with this? Here is what i have, but when I hit submit, it opens my email client, i want to avoid that and just have it send and show "your message has been sent" or something like that. any help would be great!
<CODE>
<form action="mailto:franny@frannysites.com" method="post" id="shout_out">
Your Name: <input type="text" name="name" /><br>
Your Email: <input type="text" name="email" /><br>
<textarea name="comments" rows="5" columns="200">What's on your mind?</textarea><br>
<input type="submit" value="Shout it!" id="shout_it_button">
</form>
</CODE>
TJ111
07-18-2007, 01:13 PM
You would have to use some client side scripting for this, like PHP or ASP. If you know either of those languages its pretty easy to do.
amberfrances
07-18-2007, 01:15 PM
well i saw the sticky post that actually answers this question, so i tried the following suggestion:
<input type="hidden" name="form_email" value="YOUR_EMAIL@DOMAIN" /><br />
<input type="hidden" name="form_thankyou" value="http://www.YOURSITE.com/THANKYOUPAGE.HTML" /><br />
but i just get a "problem loading page" which is unfortunate.
tracknut
07-18-2007, 01:18 PM
I suspect you missed changing the "<form action....> line in your HTML, to whatever that sticky said. It will point the action at a server script, and you need that script to be able to run on your server. Start with finding out what languages are supported on the server, then you'll know what language your script must be in.
Dave
jasonahoule
07-18-2007, 01:19 PM
You can't do that with HTML. You will need some sort of server side scripting. There are sgi scripts that you can use to handle this or there are third party sites that you can submit the form to and they will handle the email generation.
amberfrances
07-18-2007, 01:22 PM
I then tried the php script (my server does support it) filled it out and labeled the file "feedback.php" and but it in the cgi_bin folder on my server. I then put the following form in my HTML:
<form action="/cgi_bin/feeback.php" method="post" id="shout_out">
Your Name: <input type="text" name="name" /><br>
Your Email: <input type="text" name="email" /><br>
<textarea name="comments" rows="5" columns="200">What's on your mind?</textarea><br>
<input type="submit" value="Shout it!" id="shout_it_button">
</form>
and got two errors:
The requested URL /cgi_bin/feeback.php was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
I tried running this as method POST and GET. Am i missing something in my HTML?
tracknut
07-18-2007, 01:40 PM
It's telling you it can't find the feedback.php file. Try putting the entire url (http:///blah.com/cgi_bin/feedback.php) into the action, just to make sure it's pointing at the right place. Also give us the URL to the site so we can look at the actual stuff, not pieces of it.
Dave
amberfrances
07-18-2007, 01:42 PM
sure the site is http://frannysites.com and you can check out where the form is located at:
http://frannysites.com/contact.html
and i tried to put the full URL in :(
tracknut
07-18-2007, 01:45 PM
Could you double check to see that the file is actually on the server, in that directory? I don't believe it is, or possibly it has odd permissions.
Dave
amberfrances
07-18-2007, 01:48 PM
basically what i did was went to the file, right-clicked and copied the "fetch address" and corrected from an ftp address to an http address. So the file is there and i'm sure the path is correct. I also triple checked my server and php is supported. if the PHP file had an error in it, say, maybe there is a mimssing tag, could it generate this error? For example, it could be labeled .php but maybe be missing something that makes the file invalid? would it generate the same error?
amberfrances
07-18-2007, 01:52 PM
take that back, the server says the document type is a "php: hypertext preprocessor (php) document
tracknut
07-18-2007, 01:53 PM
You might try pulling it out of the cgi_bin directory (it is neither cgi nor binary) and just put it in your top level directory. There could be a permission set on that directory which is causing the issue.
Dave
amberfrances
07-18-2007, 01:56 PM
yes i tried that, and i even attempted to make it it's own folder and setting the path.
amberfrances
07-18-2007, 01:58 PM
here's a snapshot and you'll see that the file is #7 in the list and i set the path appropriately.
TJ111
07-18-2007, 01:59 PM
Make sure you use relative paths. If it's a linux server 'include("/cgi-bin/feedback.php")' will be referring to the server root. So instead use 'include("../cgi-bin/feedback.html")' .
amberfrances
07-18-2007, 02:02 PM
i put the .php file on my home directory so there really shouldn't be any path confusion.
tracknut
07-18-2007, 02:09 PM
Let's back up one step and make sure php is actually working on the server. Make a file that looks like:
<?php
echo '<p>hello world</p>'
?>
Name it test.php and put it on your server. Then with your browser go to www.frannysites.com/test.php and see if it works.
Dave
amberfrances
07-18-2007, 02:12 PM
manually typing in the URL frannysites.com/test.php worked just fine.
also typing in frannysites.com/feedback.php brings up the re-direct page and sends a confirmation email (as if the button was pushed).
TJ111
07-18-2007, 02:19 PM
Post your PHP script
amberfrances
07-18-2007, 02:21 PM
well i'm confident in the php script, when i manually put the URL in the address bar it functions properly, this is the script from the sticky message currently posted in the HTML forum:
<?PHP
#######################################################
# This script is Copyright 2003, Infinity Web Design #
# Distributed by http://www.webdevfaqs.com #
# Written by Ryan Brill #
# All Rights Reserved - Do not remove this notice #
#######################################################
## The lines below need to be edited...
###################### Set up the following variables ######################
#
$to = "franny@frannysites.com"; #set address to send form to
$subject = "Shout Out!"; #set the subject line
$headers = "From: Franny Sites"; #set the from address, or any other headers
$forward = 1; # redirect? 1 : yes || 0 : no
$location = "http://frannysites.com"; #set page to redirect to, if 1 is above
#
##################### No need to edit below this line ######################
## set up the time ##
$date = date ("l, F jS, Y");
$time = date ("h:i A");
## mail the message ##
$msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
foreach ($_POST as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
else {
foreach ($_GET as $key => $value) {
$msg .= ucfirst ($key) ." : ". $value . "\n";
}
}
mail($to, $subject, $msg, $headers);
if ($forward == 1) {
header ("Location:$location");
}
else {
echo "Thanks!";
}
?>
tracknut
07-18-2007, 02:28 PM
manually typing in the URL frannysites.com/test.php worked just fine.
also typing in frannysites.com/feedback.php brings up the re-direct page and sends a confirmation email (as if the button was pushed).
It didn't work earlier.... have you actually tried updating your contact form html to contain the entire url? It currently is pointing at "/public_html/feedback.php"
By the way, I've run that script, you probably got a couple emails from me.
Dave
amberfrances
07-18-2007, 02:29 PM
yes i copied the path directly from my ftp client so i was sure it was correct.
amberfrances
07-18-2007, 02:32 PM
if i keep the ftp address in there, it asks for a password of course, and then generates this garbage:
$value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; } } else { foreach ($_GET as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; } } mail($to, $subject, $msg, $headers); if ($forward == 1) { header ("Location:$location"); } else { echo "Thanks!"; } ?>
tracknut
07-18-2007, 02:33 PM
Humor me. Please change your action to point at http://www.frannysites.com/feedback.php and see if it works
Dave
amberfrances
07-18-2007, 02:36 PM
some way, some how, i managed to avoid this link...and you- oh mighty designer on high, have solved my ridiculous issue. I wish it was more complicated and less embarrassing of a solution.
tracknut
07-18-2007, 02:39 PM
Whew! Glad it's working :)
Dave
amberfrances
07-18-2007, 02:40 PM
thanks again, so very much- if your time is as valuble as mine, you're pissed lol. good thing it was for my own site or i would have been furious. can't thank you enough...send a shout out sometime :)
TJ111
07-18-2007, 02:55 PM
I was poking around on your site, and sorry for being nosy, but your menu on the southpinecafe.com website doesn't work properly with firefox. I got confused and opened it up in IE and it worked fine.
amberfrances
07-18-2007, 02:59 PM
i'm sorry ,what do you mean by "doesn't work properly" and do you mean the navigation menu or the actual...MENU
TJ111
07-18-2007, 03:02 PM
Haha sorry didn't think about clarifying that one. The navigation menu doesn't work properly. Well, I guess it does "work", but it's incredibly slow, is transparent sometimes, and theres weird overlap or something.