Re: [GENERAL] Re:PostgreSQL and PHP

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: [GENERAL] Re:PostgreSQL and PHP
Дата
Msg-id 20000212052045.24746.qmail@web3005.mail.yahoo.com
обсуждение исходный текст
Список pgsql-general
Below i tried to answer your questions individually:

--- sheila bel <sheilabel@hotmail.com> wrote:
> Thank you for your reply. I tried something simplier
> that did not
> write to the database and it still didn't work. Here
> is the example:
>
> an html file called EX5.html :
> -----------------------------
>
> <html>
> <head><title>Example #5</title></head>
> <body>
>    <form method=POST action=example_5.php3>
>    EMail Address:<INPUT TYPE=TEXT
> NAME="email_address"><br>
>    Phone Number: <INPUT TYPE=TEXT
> NAME="phone_number"><br>
>    <INPUT TYPE=SUBMIT NAME=SUBMIT>
>    </form>
> </body>
> </html>
>
> example_5.php3 :
> ----------------
> <?PHP
> $message = sprintf("Form data -----------------\n");
>
> while(list($key, $value) = each($HTTP_POST_VARS)) {
>   $message .= sprintf(\#34>[%s]:%s\n",$key,$value);
> }
>
> $message .= "\n";
> $message .= "More Information
> ------------------\n");
> $message .= "The user's IP address is";
> $message .= getenv("remote_addr").".\n";
> $message .= "The user is running the web browser ";
> $message .= getenv("http_user_agent").".\n";
>
> mail("bijanbel@excite.com", "Feedback Form",
> $message, "
> From: Feedback someone@hotmail.com" );
> ?>
>
> The following are the error messages I'm getting :
>
> Warning: Variable passed to each() is not an array
> or object in
> /home/httpd/html/tests/example_5.php3 on line 4
>

it is possible that the PHP you are using does not
have variable tracking enabled. check for the file
php.ini ( I am using PHP4.0b3, for a php3.x it may be
named something like php3.ini ). If there is no file
by this name you are probably using all default
compile options. If this is the case you should at
least have a file called php.ini-dist or something to
that effect, maybe php3.ini-dist. Move that file to a
position which it searches ( if you can't do this tell
me what platform you are running ), which is somewhat
explained at the head of the file. In that file is a
line that toggles 'track_vars', turn it 'On'.

> Warning: Unexpected character in input: '\'
> (ASCII=92) state=1 in
> /home/httpd/html/tests/example_5.php3 on line 5
>

I am not real familiar with the sprintf stuff you are
doing, but it definately looks like you're missing a
starting quote in the first argument.

> Parse error: parse error, expecting `')'' in
> /home/httpd/html/tests/example_5.php3 on line 6
>

caused by same problem I think

> >>>It seems like it is not recognizing
> $HTTP_POST_VARS as an
> array ?  Any ideas ?
>

I put my ideas in the big paragraph under the error
with each().

> >>>All I want to do in general is to fill out a form
> that generates
> an email message. Then when I get this part working
> I'll use it to
> insert data in the database.
>
> -Sheila
>
______________________________________________________
> Get Your Private, Free Email at
> http://www.hotmail.com
>
>

Try this simple code and see how it works:
file.php3:
---------
<?PHP
if($email) //test to see if they have submitted the
form yet
{
$body = "Their email:\n$email\nTheir phone
number:\n$phone"
mail($to,"Testing mail()",$body,$email);
echo "done"; //otherwise you don't know if something
happened
}
?>
<html>
<body>
<form action="file.php3" method=post><!-- Make sure
that points to same file as you named it -->
<input type=text name=email><br>
<input type=text name=phone><br>
<input type=submit>
</form>
</body>
</html>
---------
see whether that works. Some more '.ini' configuration
might be needed to get it to recognize your sendmail.
Try something also simple to see if you get errors
with pg_connect(), etc.

Good luck,
-Jeff Davis
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

В списке pgsql-general по дате отправления:

Предыдущее
От: Lincoln Yeoh
Дата:
Сообщение: Re: [GENERAL] Probs with float8, geometry, abstime regression tests on Linux
Следующее
От: "sheila bel"
Дата:
Сообщение: Re: [GENERAL] Re:PostgreSQL and PHP