lilbadger25 Posted January 30, 2008 Share Posted January 30, 2008 This should be a simple thing, but I have apparently moved something to the wrong place, or deleted something important. I'm sure someone with an educated eye will be able to spot the issue right away (hopefully). <?php require_once('../connections/ste.php'); $connection = mysql_connect($hostname_site, $username_site, $password_site) or die ("Unable to connect!"); mysql_select_db($database_site); $qry = mysql_query("SELECT * FROM clients") or trigger_error("SQL", E_USER_WARNING); while($row == mysql_fetch_assoc($qry)) { $id = $row["clientID"]; $clientName = $row["client"]; $clientURL = $row["address"]; if (!isset($_POST['action'])) { ?> <table align="left" cellpadding="5" cellspacing="5"> <form action="<? echo $PHP_SELF; ?>" method="post"> <input type="hidden" name="clientID" value="<? echo $id; ?>" /> <tr> <td valign="top" align="left"><b>Client Name:</b></td> <td><input size="50" maxlength="250" type="text" name="clientName" value="<? echo $clientName; ?>" /> </td> </tr> <tr> <td valign="top" align="left"><b>Client URL:</b></td> <td><input size="50" maxlength="250" type="text" name="clientURL" value="<? echo $clientURL; ?>" /> </td> </tr> <tr> <td valign="top" align="left"> </td> <td align=center><input type="submit" name="action" id="action" value="action" /></td> </tr> <input type="submit" value="Submit" name="action" /> </form> </table> <?php $qry = "UPDATE clients SET client = '$clientName', address = '$clientURL', WHERE clientID = '$id'"; $result = mysql_query($qry) or die ("Error in query: $qry. " . mysql_error()); $errorList = array(); $count = 0; if (sizeof($errorList) == 0) echo "Update successful! <a href=clientList.php>Go back to the Client List page.</a>."; mysql_close($connection); } else { echo "The following errors were encountered: <br>"; echo "<ul>"; for ($x=0; $x<sizeof($errorList); $x++) echo "<li>$errorList[$x]"; } echo "</ul>"; } ?> As with the other script I'm having trouble with, that is similar to this one (but having different issues), the $id comes from the page before. It's a list of clients and if the admin would like to edit a certain client, he clicks the "edit" link that passes the variable. The form should populate with the client's name and url but with this script, the form isn't showing up at all. I've looked at older scripts I've done that do simliar things and I can't pinpoint what the issue is. I've looked at past scripts I've done that do similar things, I've moved things around, and I've either gotten an error or the current result. What's broken? Quote Link to comment https://forums.phpfreaks.com/topic/88632-my-simple-forms-not-showing-up/ Share on other sites More sharing options...
kts Posted January 30, 2008 Share Posted January 30, 2008 Try closing and re-opening your browser? Quote Link to comment https://forums.phpfreaks.com/topic/88632-my-simple-forms-not-showing-up/#findComment-453847 Share on other sites More sharing options...
lilbadger25 Posted January 30, 2008 Author Share Posted January 30, 2008 I tried that, kts. Same issue Quote Link to comment https://forums.phpfreaks.com/topic/88632-my-simple-forms-not-showing-up/#findComment-453850 Share on other sites More sharing options...
kts Posted January 30, 2008 Share Posted January 30, 2008 are you receiving any errors? or just blank? Quote Link to comment https://forums.phpfreaks.com/topic/88632-my-simple-forms-not-showing-up/#findComment-453857 Share on other sites More sharing options...
lilbadger25 Posted January 30, 2008 Author Share Posted January 30, 2008 just blank. isnt there a code that will list errors? Quote Link to comment https://forums.phpfreaks.com/topic/88632-my-simple-forms-not-showing-up/#findComment-453861 Share on other sites More sharing options...
kts Posted January 30, 2008 Share Posted January 30, 2008 error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/88632-my-simple-forms-not-showing-up/#findComment-453862 Share on other sites More sharing options...
revraz Posted January 30, 2008 Share Posted January 30, 2008 Missing { here? if (sizeof($errorList) == 0) { <--- Quote Link to comment https://forums.phpfreaks.com/topic/88632-my-simple-forms-not-showing-up/#findComment-453863 Share on other sites More sharing options...
lilbadger25 Posted January 30, 2008 Author Share Posted January 30, 2008 I added a } before if (!isset($_POST['action'])) { I ended up deleting the line: $count = 0; if (sizeof($errorList) == 0) because it seemed redundant with for ($x=0; $x<sizeof($errorList); $x++) (was I wrong?) Now, I get: Error in query: UPDATE clients SET client = '', address = '', WHERE clientID = '15'. You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE clientID = '15'' at line 1 Where the query is $qry = "UPDATE clients SET client = '$clientName', address = '$clientURL', WHERE clientID = '$id'"; Quote Link to comment https://forums.phpfreaks.com/topic/88632-my-simple-forms-not-showing-up/#findComment-453887 Share on other sites More sharing options...
lilbadger25 Posted January 30, 2008 Author Share Posted January 30, 2008 deleted the comma after '$clientURL' and that removed the query error. the form shows up but is blank. it's supposed to populate the fields using the $id that is passed through the URL. Quote Link to comment https://forums.phpfreaks.com/topic/88632-my-simple-forms-not-showing-up/#findComment-453888 Share on other sites More sharing options...
kts Posted January 30, 2008 Share Posted January 30, 2008 The variables aren't being passed. The update info is blank. Quote Link to comment https://forums.phpfreaks.com/topic/88632-my-simple-forms-not-showing-up/#findComment-453890 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.