Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP/IIS6.0 Form not submitting data entered. 1

Status
Not open for further replies.

koolage

IS-IT--Management
Jan 3, 2005
60
Thanks in advance for your time and consideration.

I have a form in html that calls on a php file to send an email to a certain address. that works fine.
you can see a sample on the form works great from that site, however at another ISP(which I cannot share what ISP, yet)it does not work properly. it sends the email but no data entered.

the code for the html page is this:

<form name="form1" method="post" action="contact.php">
<p><font face="Palatino Linotype">Name:</font>
<input type="text" name="name" size="30">
<br>
<font face="Palatino Linotype"><br>
Email Address: </font>
<input type="text" name="email" size="30">
<br>
<font face="Palatino Linotype"><br>
Phone Number: </font>
<input type="text" name="phone" size="15">
<br>
<font face="Palatino Linotype"><br>
Station Affiliate:</font>
<input type="text" name="affliate" size="10"> <br>
<br>
<font face="Palatino Linotype">City/State: </font>
<input type="text" name="city" size="30">
<br>
<font face="Palatino Linotype"><br>
Best time to contact: </font>
<select size="1" name="time">
<option selected>Select</option>
<option>8am - 12pm</option>
<option>12pm - 4pm</option>
<option>4pm - 8pm</option>
<option>after 8pm</option>
</select>
<br>
<font face="Palatino Linotype"><br>
Budget: </font>
<input type="text" name="budget" size="7" maxlength="15">
<br>
<font face="Palatino Linotype"><br>
Additional
Information:</font><br>
<textarea name="info" rows="5" cols="30" wrap="VIRTUAL"></textarea>
<br>
&nbsp;</font></p>
<p>
<font color="#800000">
<input type="submit" name="submit_mail" value="Submit">
<input type="reset" value="Reset" name="B2"> </font>
</p>
</form>

the code for the php file is this:


<?php

if ($submit_mail = "Submit"){

$body = "Name: ".$name."\n\n\n";
$body .= "Phone Number:\n".$phone."\n\n\n";
$body .= "Station Affliate:\n".$affliate."\n\n\n";
$body .= "City & State:\n".$city."\n\n\n";
$body .= "Best time to call:\n".$time."\n\n\n";
$body .= "Budget:\n".$budget."\n\n\n";
$body .= "Additional Information:\n".$info."\n\n\n";

$subject="CONTACT INFO FROM JIMMILLERVOICEOVERS";

$header="From: ".$email."\r\n";

mail("me@aol.com", $subject, $body, $header);
mail("me@aol.com", $subject, $body, $header);

header("Location: sentmail.html");

}


?>

I'm not sure what they are running on the server that this is on.
I'm trying to get it to work with Win2K3 and IIS6.0

any help would be appreciated.

~koolage
 
hi,
probable they(ISP) have the register_globals==Off
and you have register_globals=On.
it's a php.ini settings

to verify that, just create a .php page with
Code:
<?php
phpinfo();
?>
and loook for `register_globals'

In case of register_globals==Off, you have to use $_POST['submit_mail']
$_POST['phone']
...
and so on

PM

___
____
 
Thanks folks.
It WAS the `register_globals'. it was set to OFF.

now with that. is it best to keep it OFF?

I don't know the "security issues" that arise.
this is from the php.ini
"You should do your best to write your scripts so that they do not require register_globals to be on Using form variables as globals can easily lead to possible security problems, if the code is not very well thought of."

thanks again for your help.

~koolage
 
it's better to work with register_globals OFF.

Also you have to keep in mind that the code wich works with register_globals=OFF, will work with the _global=On, with no problem.

PM

___
____
 
Okay,
now predamarcel,
I'm faily new to PHP and I'm using 5.02.
I have not researched this yet, but from what you posted...should my code look something like this to be able to use it with register_globals OFF?

<?php

if ($_POST['submit_mail'] = "Submit"){

$_POST ['body'] = "Name: ".$_POST['name']."\n\n\n";
$_POST ['body'] .= "Phone Number:\n".$_POST['phone']."\n\n\n";
$_POST ['body'] .= "Station Affliate:\n".$_POST['affliate']."\n\n\n";


could you give a a full liner sample?

thanks in advance,
~koolage
 
not quite .. :)

the idea is:
$_POST is a variable, an associative array, the keys are the NAME of FORM's fields, and the values of array are the values of FORM's fields.

to understand better what means $_POST, do a
Code:
print_r($_POST);
in your .php file


you dont have to use $_POST['body'].
ATTENTION, you have used: $_POST ['body']
was a space there which generate a syntax error.

so, your code should be like:
Code:
 if ($_POST['submit_mail'] = "Submit"){
    
        $body = "Name: ".$_POST['name']."\n\n\n";
        $body .= "Phone Number:\n".$_POST['phone']."\n\n\n";
        $body .= "Station Affliate:\n".$_POST['affliate']."\n\n\n";
...


BTW: similar with $_POST, exists $_GET, and a feew more vars.

PM



___
____
 
GREAT!!

THANKS FOR CHECKING THE FORUM TODAY!!

GLAD YOU WERE ABLE TO HELP!

~koolage
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top