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@xxxxxxx> To: <php-db@xxxxxxxxxxxxx> Sent: Tuesday, February 10, 2004 12:49 AM Subject: 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> > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php