HighDots Forums  

sending a form

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss sending a form in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jennsite
 
Posts: n/a

Default sending a form - 07-05-2004 , 10:50 PM






"No input file specified." is what I get when I click on my send button on my
forms page. It's a simple e-mail form done in Dreamweaver. Four fields, all
labeled. I chose 'Post' on the form options. I inserted this code:

<input name="Submit" type="submit" class="style2" id="Submit" value="Send"
onClick="POST"/>

for the target, I have contactform.php. The php file is as follows:

<?PHP

$name = $_POST["name"];
$company = $_POST["company"];
$email = $_POST["email"];
$message = $_POST["message"];

$to = "name (AT) geary (DOT) k12.ok.us";
$msg = "$name\n\n";
$msg .= "$message\n\n";

mail($to, $subject, $msg, "From: Website\nReply-To: $email\n");

?>

I've done a successful variation of this with Flash and it works great. I
haven't done it yet with Dreamweaver and was sort of cobbling together things
form the flash way and things from a dreamweaver book. I know I've botched it
royally, but don't know how. Can anybody help?

Thanks



Reply With Quote
  #2  
Old   
Gary White
 
Posts: n/a

Default Re: sending a form - 07-06-2004 , 12:09 AM






"jennsite" <webforumsuser (AT) macromedia (DOT) com> wrote

Quote:
"No input file specified." is what I get when I click on my send button on
my
forms page. It's a simple e-mail form done in Dreamweaver. Four fields,
all
labeled. I chose 'Post' on the form options. I inserted this code:

What does the <form> tag look like? Even better would be to post a URL to
the page, so people can see the whole thing.

Gary




Reply With Quote
  #3  
Old   
jennsite
 
Posts: n/a

Default Re: sending a form - 07-06-2004 , 01:31 AM



no problem, Gary. thanks for responding. the page is http://www.geary.k12.ok.us/clients/contact.html

Reply With Quote
  #4  
Old   
Alan
 
Posts: n/a

Default Re: sending a form - 07-06-2004 , 06:18 AM





Quote:
http://www.geary.k12.ok.us
That's a windows 2000 server.

Questions- Does any php file execute?

Is php installed as a cgi, and does it require a "shebang" line at top of
php files?



Reply With Quote
  #5  
Old   
Gary White
 
Posts: n/a

Default Re: sending a form - 07-06-2004 , 09:20 AM



On Tue, 6 Jul 2004 05:31:49 +0000 (UTC), "jennsite"
<webforumsuser (AT) macromedia (DOT) com> wrote:

Quote:
no problem, Gary. thanks for responding. the page is
http://www.geary.k12.ok.us/clients/contact.html

For debugging purposes, create a new PHP file and delete ALL content
from it. Replace it with the following line:

<?php phpinfo(); ?>

That should be the only line in the source code of the page. Save the
file with a .php file extension, upload it, then view the uploaded file
in a browser. If PHP is correctly installed and configured, you should
see a page with a great deal of information about your PHP installation.

1. Did that work and show the information?
2. What version of PHP is shown at the top?
3. Scroll down until you find the value for "Internal Sendmail Support
for Windows". Does it show as enabled?
4. Is there a mail server configured on the machine?


Gary


Reply With Quote
  #6  
Old   
jennsite
 
Posts: n/a

Default Re: sending a form - 07-09-2004 , 02:28 PM



Hiya Gary. Thanks for the reply. I did as you suggested and here are the
results:

Yes, it worked and showed the information.
4.3.0 is the PHP version shown at the top.
Internal Sendmail Support for Windows is enabled.
Not real sure how to answer that last question. Yes, the server provides a
web-based mail service. But I'm not sure if that is what you mean.

What follows is the code in the page as it now stands:

<?= $deliverymessage ?>
<form action="contactform.php" method="post"
enctype="multipart/form-data" name="form1" id="form1">
<p>&nbsp; </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name:
<input name="name" type="text" class="style2" id="name"
size="24" />
</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Company Name:
<input name="company" type="text" class="style2"
id="company" size="24" />
</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E-mail address:
<input name="email" type="text" class="style2" id="email"
size="24" />
</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Comments/Inquiries: </p>
<p>
<textarea name="message" cols="60" rows="8" class="style2"
id="message"></textarea>
</p>
<p align="center">
<input name="Submit" type="submit" class="style2"
id="Submit" value="Send" onClick="POST"/>

</p>
</form>

What follows is the code in the PHP file as it now stands:

<?PHP

$name = $_POST["name"];
$company = $_POST["company"];
$email = $_POST["email"];
$message = $_POST["message"];

$to = "jennsite (AT) geary (DOT) k12.ok.us";
$msg = "$name\n\n";
$msg .= "$message\n\n";

mail($to, $subject, $msg, "From: Courtroom Video Website\nReply-To:
$email\n");

?>


<?php
//trim whitespace

$name=trim($name);
$email=trim($email);
$company=trim($company);
$message=trim($message);

//check email is valid

if (!eregi("^[a-zA-Z0-9_\-\.\-\\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$",
$email))
{
echo "You have entered an invalid email address. Please return to the
previous page and try again.";
exit;
}

//set headers and format email content

$headers .= "From: Courtroom Video: Website Enquiry
<jennsite (AT) geary (DOT) k12.ok.us>\n";
$headers .= "Reply-To: ".$email."\n";
$headers .= "X-Sender: <jennsite (AT) geary (DOT) k12.ok.us>\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n";
$headers .= "Return-Path: <jennsite (AT) geary (DOT) k12.ok.us>\n";
$toaddress = "jennsite (AT) geary (DOT) k12.ok.us";
$mailcontent = "Customers Name: ".$name." \r\n"
."Customers Email: ".$email."\r\n"
."Customers Company: ".$company."\r\n"
."Message: ".$message."\r\n";

//process email and warn if errors encountered
if(mail($toaddress,"Website enquiry from
".$firstname,stripslashes($mailcontent),$heade rs) == true) {
$deliverymessage = "<b>Thank you, your enquiry about our services has been
successfully sent, expect a response within one business day.</b>";
}
else {
$deliverymessage = "<b>Sorry, there has been an error with your request.</b>
Please press the back button on your browser and try again.";
}

?>

The mail is now going through. Though, when the user hits the 'Send' button
on the page, what they're getting is:

Notice: Undefined variable: subject in
d:\vdomains\web\geary\users\webadmin\clients\conta ctform.php on line 12

Notice: Undefined variable: headers in
d:\vdomains\web\geary\users\webadmin\clients\conta ctform.php on line 35

Notice: Undefined variable: firstname in
d:\vdomains\web\geary\users\webadmin\clients\conta ctform.php on line 48

Plus which, it's sending two mails. One looks like this:

Customers Name: me
Customers Email: jennsite411 (AT) netscape (DOT) net
Customers Company: my company
Message: hiya
with a Subject: Website inquiry form

And one looks like this:

me

hiya

with no subject named in the Subject: line.


Reply With Quote
  #7  
Old   
Gary White
 
Posts: n/a

Default Re: sending a form - 07-09-2004 , 07:09 PM



On Fri, 9 Jul 2004 18:28:36 +0000 (UTC), "jennsite"
<webforumsuser (AT) macromedia (DOT) com> wrote:

See comments below:


Quote:
?PHP

$name = $_POST["name"];
$company = $_POST["company"];
$email = $_POST["email"];
$message = $_POST["message"];

$to = "jennsite (AT) geary (DOT) k12.ok.us";
$msg = "$name\n\n";
$msg .= "$message\n\n";

mail($to, $subject, $msg, "From: Courtroom Video Website\nReply-To:
$email\n");
The above line sends an e-mail. You have used a variable called
$subject, but have never assigned a value to it.

<snipped>


Quote:
//set headers and format email content

$headers .= "From: Courtroom Video: Website Enquiry
jennsite (AT) geary (DOT) k12.ok.us>\n";
The above line attempts to concatenate a string to an existing variable
called $headers, but there is no variable $headers yet created. Change
the above line to:

$headers = "From: Courtroom Video: Website Enquiry
<jennsite (AT) geary (DOT) k12.ok.us>\n";


<snipped>

Quote:
if(mail($toaddress,"Website enquiry from
".$firstname,stripslashes($mailcontent),$heade rs) == true) {
$deliverymessage = "<b>Thank you, your enquiry about our services has been
successfully sent, expect a response within one business day.</b>";
}
The above line sends another e-mail, but uses another variable called
$firstname that has never been created, nor had a value assigned to it.

I don't know if you've added the first mail() function in an attempt to
debug the script, or what you're trying to do there.



Gary


Reply With Quote
  #8  
Old   
jennsite
 
Posts: n/a

Default Re: sending a form - 07-12-2004 , 04:40 PM



ok. fixed the onClick thing. fixed redundant script. fixed enctype. now
it's not even sending one mail. Plus, getting a runtime error that says 'POST'
not defined, followed by these errors:

Notice: Undefined variable: name on line 6
Notice: Undefined variable: email on line 7
Notice: Undefined variable: company on line 8
Notice: Undefined variable: message on line 9

which, honesty, I don't get. they're defined right below. i think, anyway.
plus, they are the names sent from the form as variable names. So, what gives
now? What follows is the php file as well as the form code from the page as
they stand now. Please keep bearing with me. You have been a big help.

<?php
//trim whitespace

$name=trim($name);
$email=trim($email);
$company=trim($company);
$message=trim($message);

//check email is valid

if (!eregi("^[a-zA-Z0-9_\-\.\-\\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$",
$email))
{
echo "You have entered an invalid email address. Please return to the
previous page and try again.";
exit;
}

//set headers and format email content

$headers .= "From: Courtroom Video: Website Enquiry
<jennsite (AT) geary (DOT) k12.ok.us>\n";
$headers .= "Reply-To: ".$email."\n";
$headers .= "X-Sender: <jennsite (AT) geary (DOT) k12.ok.us>\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n";
$headers .= "Return-Path: <jennsite (AT) geary (DOT) k12.ok.us>\n";
$toaddress = "jennsite (AT) geary (DOT) k12.ok.us";
$mailcontent = "Customers Name: ".$name." \r\n"
."Customers Email: ".$email."\r\n"
."Customers Company: ".$company."\r\n"
."Message: ".$message."\r\n";

//process email and warn if errors encountered
if(mail($toaddress,"Website enquiry from
".$name,stripslashes($mailcontent),$headers) == true) {
$deliverymessage = "<b>Thank you, your enquiry about our services has been
successfully sent, expect a response within one business day.</b>";
}
else {
$deliverymessage = "<b>Sorry, there has been an error with your request.</b>
Please press the back button on your browser and try again.";
}

?>

___________________________________________

<?= $deliverymessage ?>
<form action="contactform.php" method="post" name="form1"
id="form1">
<p>&nbsp; </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name:
<input name="name" type="text" class="style2" id="name"
size="24" />
</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Company Name:
<input name="company" type="text" class="style2"
id="company" size="24" />
</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;E-mail address:
<input name="email" type="text" class="style2" id="email"
size="24" />
</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Comments/Inquiries: </p>
<p>
<textarea name="message" cols="60" rows="8" class="style2"
id="message"></textarea>
</p>
<p align="center">
<input name="Submit" type="submit" class="style2"
id="Submit" value="Send" onClick="POST"/>

</p>
</form>


Reply With Quote
  #9  
Old   
Gary White
 
Posts: n/a

Default Re: sending a form - 07-12-2004 , 05:34 PM



On Mon, 12 Jul 2004 20:40:07 +0000 (UTC),
"jennsite" <webforumsuser (AT) macromedia (DOT) com> wrote:

Quote:
ok. fixed the onClick thing.

Try this:

<?php
//trim whitespace
$name=stripslashes(trim($_POST['name']));
$email=stripslashes(trim($_POST['email']));
$company=stripslashes(trim($_POST['company']));
$message=stripslashes(trim($_POST['message']));

//check email is valid
if (!eregi("^[a-zA-Z0-9_\-\.\-\\-]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$", $email))
{
echo "You have entered an invalid email address. Please return to the previous page and try again.";
exit;
}

//set headers and format email content
$headers = "From: Courtroom Video: Website Enquiry <jennsite (AT) geary (DOT) k12.ok.us>\n";
$headers .= "Reply-To: ".$email."\n";
$headers .= "X-Sender: <jennsite (AT) geary (DOT) k12.ok.us>\n";
$headers .= "X-Mailer: PHP4\n";
$headers .= "X-Priority: 3\n";
$headers .= "Return-Path: <jennsite (AT) geary (DOT) k12.ok.us>\n";
$toaddress = "jennsite (AT) geary (DOT) k12.ok.us";
$mailcontent = "Customers Name: ".$name." \r\n"
."Customers Email: ".$email."\r\n"
."Customers Company: ".$company."\r\n"
."Message: ".$message."\r\n";

//process email and warn if errors encountered
if(mail($toaddress,"Website enquiry from ".$name,$mailcontent,$headers) == true) {
$deliverymessage = "<b>Thank you, your enquiry about our services has been successfully sent, expect a response within one business day.</b>";
}
else {
$deliverymessage = "<b>Sorry, there has been an error with your request.</b> Please press the back button on your browser and try again.";
}
?>


Gary


Reply With Quote
  #10  
Old   
jennsite
 
Posts: n/a

Default Re: sending a form - 07-12-2004 , 07:25 PM



ok. switched the code as you suggested. not getting the later errors about
undefined variables name, etc. but still getting runtime error about post
being undefined. And no message is coming through after mail is sent coming
sending to the user. Just a blank page. Though we are moving the mail now.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.