dlyles Posted November 30, 2006 Share Posted November 30, 2006 I promise you guys by the end of the weekend, I'll have this enough to eliminate the need for repeated questions. In the meantime, can someone give me a heads up as to what's wrong with this basic form? I'm not getting any errors, but I'm also not seeing anything on the page. No form, no data...[code]<?php$db = mysql_connect(*******);mysql_select_db("inventory",$db);if ($id) { // query the DB $sql = "SELECT * FROM groups WHERE id=$id"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result); ?> <form method="post" action="<?php echo $PHP_SELF?>"> <input type=hidden name="id" value="<?php echo $myrow["id"] ?>"> Group Name:<input type="Text" name="groupname" value="<?php echo $myrow["GroupName"] ?>"><br> <input type="Submit" name="submit" value="Enter information"> </form> <?php} else { // display list of Groups $result = mysql_query("SELECT * FROM groups",$db);echo $result; while ($myrow = mysql_fetch_array($result)) {$group=$row['GroupName'];echo $row['GroupName']; }}?>[/code] Link to comment https://forums.phpfreaks.com/topic/28972-another-syntax-issue/ Share on other sites More sharing options...
Jocka Posted November 30, 2006 Share Posted November 30, 2006 i'll take a shot in the dark and guess u have globals on?well for one this could be fixed "<?php echo $PHP_SELF?>" should be "<?php echo $PHP_SELF; ?>"but that shouldn't cause the problemLooks like when submitting your showing them the form again instead of the page. What you want to do is more something like this:[code]<?php$db = mysql_connect(*******);mysql_select_db("inventory",$db); // query the DB $sql = "SELECT * FROM groups WHERE id=$id"; $result = mysql_query($sql); $myrow = mysql_fetch_array($result);if (!isset($id)) { ?> <form method="post" action="<?php echo $PHP_SELF; ?>"> <input type=hidden name="id" value="<?php echo $myrow["id"] ?>"> Group Name:<input type="Text" name="groupname" value="<?php echo $myrow["GroupName"] ?>"><br> <input type="Submit" name="submit" value="Enter information"> </form> <?php} else { // display list of Groups $result = mysql_query("SELECT * FROM groups",$db);echo $result; while ($myrow = mysql_fetch_array($result)) {$group=$row['GroupName'];echo $row['GroupName']; }}?>[/code] Link to comment https://forums.phpfreaks.com/topic/28972-another-syntax-issue/#findComment-132696 Share on other sites More sharing options...
dlyles Posted November 30, 2006 Author Share Posted November 30, 2006 Thanks! Link to comment https://forums.phpfreaks.com/topic/28972-another-syntax-issue/#findComment-132712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.