Re: PHP_SELF and parse error
| From: | Chris Wright | Date: | Tue, 10 Feb 2004 00:58:55 +0000 |
| Subject: | Re: PHP_SELF and parse error | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-32878@lists.php.net to get a copy of this message | ||
Try using $_SERVER["PHP_SELF"] instead of $PHP_SELF.
I believe $PHP_SELF is only set on servers with register variables turned
on.
ChrisPW
----- Original Message -----
From: <Remember14a@aol.com>
To: <php-db@lists.php.net>
Sent: Tuesday, February 10, 2004 12:49 AM
Subject: [PHP-DB] PHP_SELF and parse error
> Dear friends,
>
> I tried to modify submit if elseif statement. That didn't work.I have
pasted
> code of form and output with error.
> Any comments on erros, please.
>
> Asif
>
>
>
> --------------------------------------------------------------------------
----
> ---------------------------
> Notice: Undefined variable: submit in C:\webroot\display.php on line 16
>
> Notice: Undefined variable: PHP_SELF in C:\webroot\display.php on line 19
>
>
> 1
> Treatment of Hypertension
>
> a)loop diuritics
> b)clonazepam
> c)benzodizap
> d)lorazepam
>
> 2
> Thrombolytic treatment of Myocardial infarction
>
> a)streptokinase
> b)diltiazm
> c)aspirin
> d)heparin
>
>
> --------------------------------------------------------------------------
----
> -------------------------------------
> //code for above output and error
>
>
> <HTML><body bgcolor=""><?php
> // open the connection
> $conn = mysql_connect("localhost", "", "");
>
> // pick the database to use
> mysql_select_db("testDB",$conn);
>
>
> // create the SQL statement
> $sql = "SELECT * FROM testTable";
>
> // execute the SQL statement
> $result = mysql_query($sql, $conn) or die(mysql_error());
> //go through each row in the result set and display data
>
> if (!$submit) {
>
>
> echo "<form method=post action=$PHP_SELF>";
> echo "<table border=0>";
>
>
>
> while ($newArray = mysql_fetch_array($result)) {
> // give a name to the fields
> $id = $newArray['id'];
> $testField = $newArray['testField'];
> $testFielda = $newArray['testFielda'];
> $testFieldb = $newArray['testFieldb'];
> $testFieldc = $newArray['testFieldc'];
> $testFieldd = $newArray['testFieldd'];
>
> //echo the results onscreen
>
>
> echo
> "<tr><td
> colspan=4><br><b>$id</b></td></tr>";
> echo
> "<TD>$testField<input type=hidden name=$testField
> value=\"$testField\">
<br>
> </td></tr>
> <TD>a)<input type=radio name=$testFielda
> value=\"$testFielda\">$testFielda</td></tr>
> <TD>b)<input type=radio name=$testFieldb
> value=\"$testFieldb\">$testFieldb</td></tr>
> <TD>c)<input type=radio name=$testFieldc
> value=\"$testFieldc\">$testFieldc</td></tr>
> <TD>d)<input type=radio name=$testFieldd
> value=\"$testFieldd\">$testFieldd</td></tr>";
> }
> echo "</table>";
>
>
> echo "<input type='submit' value='See how you did'
> name='submit'>";
>
> echo "</form>";
>
> }
>
> elseif ($submit)
>
> ?>
> </html>
>