RE: [PHP-DB] Form response
| From: | John Holmes | Date: | Fri, 20 Sep 2002 13:17:04 +0000 |
| Subject: | RE: [PHP-DB] Form response | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-21867@lists.php.net to get a copy of this message | ||
If you're seeing PHP source code when you pull up a page, your server is
not configured correctly. What if you try a basic .php page like echo
"Hello World";, does that work?
You are running a web server right, not just using File->Open??
---John Holmes...
> -----Original Message-----
> From: Warren Massengill [mailto:warrenmassengill@hotmail.com]
> Sent: Friday, September 20, 2002 3:06 AM
> To: holmes072000@charter.net
> Cc: php-db@lists.php.net
> Subject: RE: [PHP-DB] Form response
>
>
>
>
> Try $_POST['field_1'] instead of $field_1
>
> ---John Holmes...
>
>
> I tried this with two different versions of reaction.php.
> Still displays only the source code.
>
> Thanks,
> Warren
> ----------------------------------------
> <html>
> <body>
> A Simple Form
> <br><br>
> <form action="reaction.php" method="post">
> <input type="text" name="$_POST['field_1']"
size="10"><br><br>
> <input type="submit" name="submitbutton">
> </form>
> </body>
> </html>
> ---------------------------------------------
> <?php
> if ($$_POST['field_1'])
> {
> echo "$_POST['field_1']: $$_POST['field_1']";
> }
> else
> {
> echo "nothing has been passed to this script";
> }
> ?>
> ---------------------------------------------------
> <?php
> if ($field_1)
> {
> echo "$_POST['field_1']: $field_1";
> }
> else
> {
> echo "nothing has been passed to this script";
> }
> ?>
> -----------------------------------------------------
>
> <?php
> if ($$_POST['field_1'])
> {
> echo "$_POST['field_1']: $$_POST['field_1']";
> }
> else
> {
> echo "nothing has been passed to this script";
> }
> ?>
> -----------------------------------------------------
>
> I tried this with two different versions of reaction.php.
> Still displays only the source code.
>
> Thanks,
> Warren
>
> >-----Original Message-----
> >From: Warren Massengill [mailto:warrenmassengill@hotmail.com]
> >Sent: Thursday, September 19, 2002 8:19 PM
> >To: php-db@lists.php.net
> >Subject: [PHP-DB] Form response
> >
> >Hi,
> >
> >RedHat 7.2 RPM with PostgreSQL 7.1.x and PHP 4.0.6
> >
> >Page 111 of "PHP and PostgreSQL", this form displays in Mozilla. The
> >submit
> >button is expected to run a script called reaction.php but it opens
> the
> >script and displays the code. The response is the same with or
without
> >variable input.
> >
> >I changed the script file to executable: no effect.
> >
> >I can run 'reaction.php' from the shell and it works.
> >What is the problem here?
> >---------------------------------
> >form
> >-----------------------------------------------------------------
> ><html>
> ><body>
> > A Simple Form
> > <br><br>
> > <form action="reaction.php" method="post">
> > <input type="text" name="field_1"
> > size="10"><br><br>
> > <input type="submit" name="submitbutton">
> > </form>
> ></body>
> ></html>
> >
> >-------------
> >Reaction.php
> >------------------------------------------------------------------
> >action.php
> >
> ><?php
> > if ($field_1)
> > {
> > echo "field_1: $field_1";
> > }
> > else
> > {
> > echo "nothing has been passed to this script";
> > }
> >?>
> >----------------------
> >run as stand alone php file
> >-----------------------------------------------------------------
> >
> >bash-2.05$ php < reaction.php
> >X-Powered-By: PHP/4.0.6
> >Content-type: text/html
> >nothing has been passed to this script
> >
> >----------------------------------------------------------------
> >
> >In:
> >/etc/httpd/conf/httpd.conf
> > AddType application/x-httpd-php .php
> > (appears as above plus an entry for each of php2,3,&4)
> > LoadModule php4_module modules/libphp4.so
> > LoadModule php_module modules/mod_php.so
> >
> >These were all uncommented in the RPM installation of RedHat 7.2.
> >Somehow PHP is partially working...
> >Any suggestions?
> >
> >I can create forms in php and tables in PostgreSQL but according to
> >phpinfo(), php is not configured for PostfreSQL.
> >
> >If I survive this problem, that one is on the horizon. Does anyone
> have a
> >generic list of things to do after an RPM installation of RedHat
Linux
> 7.2
> >in order to use PHP with PostgreSQL?
> >
> >Thanks,
> >Warren
>
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device:
> http://mobile.msn.com