Re: Any special functions need to be loded to accept forms?
| From: | Luke | Date: | Mon, 04 Nov 2002 03:22:31 +0000 |
| Subject: | Re: Any special functions need to be loded to accept forms? | ||
| References: | 1 2 3 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-16713@lists.php.net to get a copy of this message | ||
I just noticed something. I never wrote this script, and the variable
submitform comes from the line:
<INPUT NAME="submitform" TYPE="submit" VALUE="Submit">
I think I just have to figure out what setting I have to change in php.ini
so that it automatically looks at each element of the form. -- I say that
I think I need to edit php.ini because the script works on my linux server..
here is the entire form submitter:
<HTML>
<HEAD>
<TITLE>Email</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<?php
$youremail = "lukeh@jetstream.net";
$subject = "Contact Form";
if($_POST["submitform"]) {
$dcheck = explode(",",$require);
while(list($check) = each($dcheck)) {
if(!$$dcheck[$check]) {
$error .= "Missing $dcheck[$check]<BR>";
}
}
if($error) {
?>
<P>
<CENTER>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="100%" BGCOLOR="#004080"> <TABLE WIDTH="394"
BORDER="0"
CELLSPACING="1" CELLPADDING="2">
<TR>
<TD WIDTH="26%" BGCOLOR="#004080"> <P><B><FONT
COLOR="#ffffff" SIZE="-1"
FACE="Verdana">Error</FONT></B></TD>
</TR>
<TR>
<TD WIDTH="26%" BGCOLOR="#ffffff"> <FONT COLOR="#000000"
SIZE="-1"
FACE="Verdana"><?php echo $error; ?></FONT></TD>
</TR>
</TABLE></TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
<?php
exit();
}
if ($YourName) {
$yeshow = "\n\nFrom, $YourName\n";
}
mail($YourEmailAddress,"$subject"," $Message $yeshow ","From: $YourName
<$YourEmailAddress>");
print(" <CENTER>
<b>Thanks!<P>
<a href='javascript:history.go(-1)'>Go Back</a></b>
</CENTER>
</BODY>
</HTML>\n");
exit();
} else {
?>
<FORM ACTION=emailform.php METHOD="POST">
<CENTER>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR><TD WIDTH="100%" BGCOLOR="#004080"> <TABLE
WIDTH="394" BORDER="0"
CELLSPACING="1" CELLPADDING="2">
<TR><TD COLSPAN="2" BGCOLOR="#004080"> <B><FONT
COLOR="#ffffff" SIZE="-1"
FACE="Verdana">Contact Form</FONT></B></TD></TR>
<TR> <TD WIDTH="48%" BGCOLOR="#ffffff"> <B><FONT
COLOR="#000000" SIZE="-1"
FACE="Verdana">Your Name:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="YourName" TYPE="text" SIZE="25">
</TD></TR>
<TR><TD WIDTH="48%" BGCOLOR="#ffffff"> <B><FONT
COLOR="#000000" SIZE="-1"
FACE="Verdana">Your Email:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="YourEmailAddress" TYPE="text"
SIZE="25"></TD></TR>
<TR> <TD COLSPAN="2" BGCOLOR="#ffffff"><B><FONT
COLOR="#000000" SIZE="-1"
FACE="Verdana">Message:<BR>
<INPUT TYPE="hidden" NAME="require"
VALUE="YourName,YourEmailAddress,Message">
<TEXTAREA NAME="Message" ROWS="5" COLS="45"></TEXTAREA>
</FONT></B></TD></TR>
</TABLE></TD></TR>
</TABLE>
<INPUT NAME="submitform" TYPE="submit" VALUE="Submit">
</CENTER>
</FORM>
</BODY></HTML>
<?php
exit();
}
?>
Thanks again!
Luke
"Luke" <lukeh@jetstream.net> wrote in message
news:20021104030118.29591.qmail@pb1.pair.com...
> Thanks for the help! You were right about the register_globals being off!
> I tried to turn it on just to see if it fixes the problem, but I still get
> the same error:
> When I use: if($submitform){
> I get the error:
>
> Notice: Undefined variable: submitform in C:\www\emailform.php on line 9
>
> and when I use: if($_POST["submitform"]) or
> if($HTTP_POST_VARS["submitform"])
> I get the error:
>
> Notice: Undefined index: submitform in C:\www\emailform.php on line 9
>
> Does anyone have any more suggestions?
>
> Thanks Brad!
>
> Luke
>
>
> "Brad Thomas" <alarum@runyourownnetbiz.com> wrote in message
> news:20021104020732.94208.qmail@pb1.pair.com...
> > Hi
> >
> > "Luke" <lukeh@jetstream.net> wrote in message
> > news:20021103231622.13841.qmail@pb1.pair.com...
> > > I am trying to submit a form on my apache server running win2k and
php4
> > > using php, but I get the error:
> > >
> > > Notice: Undefined variable: submitform in C:\www\\emailform.php on
line
> 9
> > >
> > > The exact same php script works on another server running
> > linux/apache/php4
> > >
> > > Does anyone know if I need to load any extensions in my php.ini file
in
> > > order for php to receive variables defined in an html form? Or maybe
> what
> > > else might be the problem?
> > >
> > > here are the lines around line 1-20:
> > >
> > > <HTML>
> > > <HEAD>
> > > <TITLE>Email</TITLE>
> > > </HEAD>
> > > <BODY BGCOLOR="#ffffff">
> > > <?php
> > > $youremail = "ha@meme.com";
> > > $subject = "Contact Form";
> > > if($submitform) {
> > > $dcheck = explode(",",$require);
> > > while(list($check) = each($dcheck)) {
> > > if(!$$dcheck[$check]) {
> > > $error .= "Missing $dcheck[$check]<BR>";
> > > }
> > >
> > >
> > >
> > > Thanks!
> > >
> > > Luke :)
> > > }
> > >
> > >
> >
> > This is due to a setting in your php.ini file
> >
> > register_globals: off
> >
> > If this is the case, variables that come from a form need to be accessed
> by
> > the superglobals (PHP 4.2+) ie $_POST["variablename"];
> >
> > OR
> > the HTTP vars.. $HTTP_POST_VARS["variablename"];
> >
> > HTH
> > Brad
> >
> >
>
>