I am sure someone else will beat me to this but here is an example

update.php
---------------
<?php

echo "<html>\n";
echo "<body>\n";
//add this to assign POST to a variable you can use on this page
$sname=$_POST["sname"]
//that will give you an idea of what to do
if (isset($sname)) {
        print($sname);
        } else {
        print ("No data yet\n");
        }

echo "</body>\n";
echo "</html>\n";
?>

-----Original Message-----
From: Mazin Albahkali [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 14, 2003 10:08 AM
To: [EMAIL PROTECTED]
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

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to