By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,774 Members | 1,380 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,774 IT Pros & Developers. It's quick & easy.

form w/php action

P: n/a
Hi,

I have a form which needs posting the php script below. (I sent my vars to a
cookie, which I have read correctly). This is the form command used in
hoping to process my information.

<form method="POST" action="scripts/WebContractor.php" name="bizinfo"
id="bizinfo">

Since most of this is new to me, please let me ramble in my thought process.

1. post the vars to a cookie
2. post the form pointing to the php script
3. read the vars in the php script
4. send the info from within the script

When I submit my form, I receive a dialog box stating the downloading this
file can be dangerous. What happens is the php script is downloaded to my
desktop - not executed.

Here is the php script named WebContractor.php:

<?php
$Bizname = $HTTP_GET_VARS['BizName'];
$BizAddress = $HTTP_GET_VARS['BizAddress1'];
$BizAddress2 = $HTTP_GET_VARS['BizAddress2'];
$BizCity = $HTTP_GET_VARS['BizCity'];
$BizZip = $HTTP_GET_VARS['BizZip'];
$BizWorkPhone = $HTTP_GET_VARS['BizWorkPhone'];
$BizHomePhone = $HTTP_GET_VARS['BizHomePhone'];
$BizCellPhone = $HTTP_GET_VARS['BizCellPhone'];
$BizFax = $HTTP_GET_VARS['BizFax'];
$BizEmail = $HTTP_GET_VARS['BizEmail'];
$rec_email = "ju**********@thewrongplace.com"; // send this email to myself
$subject = "Contractor Liability Form (Web)";
// make it pretty

$msgInfo = "<html><head></head><body>";
$msgInfo = "<font face=\"Microsoft Sans Serif\" size=\"2\">";
$msgInfo .= "<hr width=\"100%\" size=\"1\" ><br>";
$msgInfo .= "<b>Bizname:</b> $Bizname<br>";
$msgInfo .= "<b>Address:</b> $BizAddress<br>";
$msgInfo .= "<b>Address2:</b> $BizAddress2<br>";
$msgInfo .= "<b>City:</b> $BizCity<br>";
$msgInfo .= "<b>Zip:</b> $BizZip<br>";
$msgInfo .= "<b>WorkPhone:</b> $BizWorkPhone<br>";
$msgInfo .= "<b>HomePhone:</b> $BizHomePhone<br>";
$msgInfo .= "<b>CellPhone:</b> $BizCellPhone<br>";
$msgInfo .= "<b>Fax:</b> $BizFax<br>";
$msgInfo .= "<b>Email:</b> $BizEmail<br>";
$msgInfo .= "</font></body></html>";

$header_info = "MIME-Version: 1.0\r\n";
$header_info .= "Content-type: text/html; charset=iso-8859-1\r\n";
$header_info .= "From: ".$name." <".$email.">";
mail($rec_email, $subject, $msgInfo, $header_info); // mail it

?>


TIA
danny
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In article <11*************@corp.supernews.com>, dt*****@planet-inc.net
enlightened us with...
Here is the php script named WebContractor.php:

<?php


This is a javascript group.
Perhaps you meant to post this to alt.php?

That said, you didn't set the actual PHP document as mime type html. The
browser didn't know what to do with it, so it tried to load it.
PHP is embedded as scriptlets INSIDE an HTML page. The PHP page needs its own
head, title, body, etc.

Also, if the server doesn't know to execute it, it won't. So make sure a
simple PHP test page works.

I use this to test.
<html><head><title>test</title></head>
<body>
<p>testing</p>
<?php
echo "<h1>Can you see this?</h1>";
?>
</body>
</html>

The page needs to display that as all html and not show the PHP stuff. If it
shows it all as plain text, the server is not configured right. It is the
server which sends the content as html.

(why is the php script in the scripts subdir? That's for perl and other cgi
type scripts...php is a scripting language embedded in html docs, not run as
standalone. the scripts subdir on many machines is configured as cgi-bin:
executables.)

HTH
--
--
~kaeli~
Can you be a closet claustrophobic?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2

P: n/a
danny wrote:
When I submit my form, I receive a dialog box stating the downloading this
file can be dangerous. What happens is the php script is downloaded to my
desktop - not executed.


Sounds like your server isn't configured to handle PHP scripts. Nothing to
do with JavaScript whatsoever.
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #3

P: n/a
<SNIP>
That said, you didn't set the actual PHP document as mime type html. The
browser didn't know what to do with it, so it tried to load it.
PHP is embedded as scriptlets INSIDE an HTML page. The PHP page needs its own
head, title, body, etc.

<SNIP>

FWIW, you don't *HAVE* to place the head/title in the script as it will
generate itself if it doesn't exist.
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.