Forum Moderators: coopster

Message Too Old, No Replies

Can't see the problem been on it for hours now.

Please help

         

Gruessle

7:54 am on Feb 23, 2005 (gmt 0)

10+ Year Member




I don't see the problem and wouldn't wonder if it was something stupid but I been on it for hours now.
The form just does not display anymore and it was working. The while stuff works!

if ($submit) {
mysql_query ("INSERT INTO profile_edu (cid,Education,School,Program) VALUES ('$uid','$Education','$School','$Program')");
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<table>
<tr>
<td><font size="-2">Education</font><br>
<input type="Text" name="Education"></td>
<td><font size="-2">School</font><br>
<input type="Text" name="School"></td>
<td><font size="-2">Program</font><br>
<input type="Text" name="Program"></td>
</tr>
<tr>
<td colspan="3"><div align="right">
<input type="reset" value="Reset">
<input type="Submit" name="submit" value="Add">
</div></td>
</tr>
</table>
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
}

// read data from database
$p_edu = mysql_query("SELECT * FROM profile_edu") // WHERE cid = '$uid'
or die ("Could not read data because ".mysql_error());

// print the data in a table
if (mysql_num_rows($p_edu)) {
print "<table cellpadding=2 cellspacing=0 border=0 width=\"100%\">\n";
print "<tr><th>Education</th><th>School</th><th>Program</th></tr>\n";
while ($qry = mysql_fetch_array($p_edu)) {
print "<tr><td>$qry[Education]</td><td>$qry[School]</td><td>$qry[Program]</td></tr>\n";
}
print "</table>\n";
}

grandpa

8:05 am on Feb 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your form appears to be enclosed within the same if statement that processes it, if ($submit), and since $submit remains FALSE until the form is submitted, the form cannot be displayed. Try moving the closing bracket of your if.

if ($submit) {
mysql_query ("INSERT INTO profile_edu (cid,Education,School,Program) VALUES ('$uid','$Education','$School','$Program')");
} <-- move to here
?>

and remove the closing bracket from this section:
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
} Moved up as indicated

Gruessle

8:23 am on Feb 23, 2005 (gmt 0)

10+ Year Member



Thats it, Thank you very much