RE: [PHP-DB] Problem with passing variables in PHP
| From: | Hutchins, Richard | Date: | Fri, 14 Mar 2003 16:15:12 +0000 |
| Subject: | RE: [PHP-DB] Problem with passing variables in PHP | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-26382@lists.php.net to get a copy of this message | ||
On update.php, you need to refer to the varibles passed from the first page
like so: $_POST["varname"]. I think that'll fix your problem.
> -----Original Message-----
> From: Mazin Albahkali [mailto:mazin@albahkali.com]
> Sent: Friday, March 14, 2003 11:08 AM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Problem with passing variables in PHP
>
>
> I'm a beginner in PHP and Database connections
>
> I'm accessing a MS Access database using PHP. Everything is
> working fine. I
> get the data through an ODBC query and show it on an HTML
> format form so
> that I can modify the data and re-post it. I tried to pass
> the values to a
> second php file that has the updating query but no luck. My PHP didn't
> accept passing variables at all. I'm using PHP 4.3.1 on IIS
> 5.1 server, I
> even tried Apatche2 with no luck.
>
> Is there a way to run an update query using data from a form
> in the same
> page without the need for passing it to another page?, and
> what is wrong
> with my server not allowing me to pass variables, is there a
> parameter in
> the server I should set on?
>
>
> Here is a test example for passing a variable that failed:
>
>
> File 1: Test Passing a variable
>
> <?PHP
>
> echo "<html>\n";
> echo "<body>\n";
>
> echo "<form name=\"Update\" method=\"post\"
> ACTION=\"update.php\">\n";
>
> echo "<p align=\"right\"><INPUT type=\"text\"
> NAME=\"sname\"
> VALUE=\"$sname\" SIZE=30></td>\n";
>
> echo "<P><INPUT TYPE=\"submit\" NAME=\"submit\"
> VALUE=\"Send\"></p>\n";
>
> echo "</FORM>\n";
>
> echo "</body>\n";
> echo "</html>\n";
>
> ?>
>
> ****************************************************
>
> File 2: update.php
>
> <?php
>
> echo "<html>\n";
> echo "<body>\n";
>
>
> if (isset($sname)) {
>
> print($sname);
>
>
> } else {
>
> print ("No data yet\n");
>
> }
>
> echo "</body>\n";
> echo "</html>\n";
>
> ?>
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>