Xtremer360 Posted January 20, 2009 Share Posted January 20, 2009 Lets try this again. What I want to happen is when I click the submit button called addhandler to add it to the DB I need it to also check to see if there is a value inside the UL and if there is something then add it to the insert tag. AjaxHandler.php //Form was submitted - determine the form if ( isset ( $_POST['addhandler'] ) ) { // Define the query. $password = md5($p); // Currently $p does not have a value $login = $_POST['login']; $p = $_POST['password']; $surname = $_POST['surname']; $firstname = $_POST['firstname']; $email = $_POST['email']; $aim = $_POST['aim']; $msn = $_POST['msn']; $forumid = $_POST['forumid']; $account = $_POST['account']; $admin = $_POST['admin']; $query = "INSERT INTO `users` (`username`, `password`, `surname`, `firstname`, `email`, `aim`, `msn`, `forumid`, `status`, `admin`) VALUES ('".addslashes($login)."', '".addslashes($p)."', '".addslashes($surname)."','".addslashes($firstname)."', '".addslashes($email)."', '".addslashes($aim)."', '".addslashes($msn)."', '".addslashes($forumid)."', '".addslashes($account)."', '".addslashes($admin)."')"; // Execute the query. if (@mysql_query ( $query )) { print '<p>The handler has been added.</p>'; } else { print '<p>Could not add the entry because: <b>"' . mysql_error() . '"</b>. The query was '.$query.'.</p>'; } //mysql_close (); } backstagefunctions.php function addhandler() { print '<h1 class="backstage">Handler Management</h1><br />'; print '<h2 class="backstage">Add New Handler Account</h2><br />'; print '<form name="addhandler" method="post" action="backstage.php" id="addhandler">'; print '<table width="100%" class="table2">'; print '<tr>'; print '<td width="120" class="rowheading">Username:</td><td class="row3"><input type="text" name="login" class="fieldtext490"></td>'; print '</tr>'; print '<tr>'; print '<td class="rowheading">Password:</td><td class="row3"><input type="password" name="password" class="fieldtext490"></td>'; print '</tr>'; print '<tr>'; print '<td class="rowheading">Surname:</td><td class="row3">'; print '<input type="text" name="surname" class="fieldtext490"></td>'; print '</tr>'; print '<tr>'; print '<td class="rowheading">Firstname:</td>'; print '<td class="row3"><input type="text" name="firstname" class="fieldtext490"></td>'; print '</tr>'; print '<tr>'; print '<td class="rowheading">Email:</td>'; print '<td class="row3"><input type="text" name="email" class="fieldtext490"></td>'; print '</tr>'; print '<tr>'; print '<td class="rowheading">AIM:</td>'; print '<td class="row3"><input type="text" name="aim" class="fieldtext490"></td>'; print '</tr>'; print '<tr>'; print '<td class="rowheading">MSN:</td>'; print '<td class="row3"><input type="text" name="msn" class="fieldtext490"></td>'; print '</tr>'; print '<tr>'; print '<td class="rowheading">Forum ID:</td>'; print '<td class="row3"><input type="text" name="forumid" class="fieldtext490"></td>'; print '</tr>'; print '<tr>'; print '<td class="rowheading">Account:</td>'; print '<td class="row3"><select name="account" class="selection"><option value="0">- Select -</option>'; print '<option value="Active">Active</option><option value="Inactive">Inactive</option>'; print '</select></td>'; print '</tr>'; print '<tr>'; print '<td class="rowheading">Administrator:</td>'; print '<td class="row3"><select name="admin" class="selection"><option value="0">- Select -</option>'; print '<option value="2">No</option><option value="1">Yes</option>'; print '</select></td>'; print '</tr>'; print '</table><br />'; print '<input type="submit" value="Save Handler" class="button" name="addhandler"></form><br />'; print '<input type="hidden" name="action" value="handlers"><input type="submit" value="Return to Handler List" class="button200"><br /><br />'; print '<script type="text/javascript" src="ajax.js"></script>'; print '<h2 class="backstage">Characters<br /><br />'; print '<form method=post name="addwrestler" onsubmit="return WrestlerList(this);"><select name="characterid" class="dropdown">'; print '<option value="">- Select -</option>'; $query = 'SELECT charactername FROM characters'; $result = mysql_query ( $query ); while ( $row = mysql_fetch_assoc ( $result ) ) { print "<option value=\"".$row['charactername']."\">".$row['charactername']."</option>\r"; } print '</select> <input name="submit" type="submit" value="Add" class="button"></form></h2><br />'; print '<ul id="characterlist"></ul><br />'; print '<h2 class="backstage"><form method="post"><input type="submit" value="Return to Main Menu" class="button200"></form></h2>'; } Quote Link to comment Share on other sites More sharing options...
flyhoney Posted January 20, 2009 Share Posted January 20, 2009 check to see if there is a value inside the UL What do you mean by this exactly? Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted January 20, 2009 Author Share Posted January 20, 2009 Meaning that with the ajax page and the dropdown it adds a li for every selection made and added to the UL. Checking I meant just see if there was any selections made and yes there could be more than one inside the UL. Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted January 20, 2009 Author Share Posted January 20, 2009 Let me rephrase all of this. My mysql insert query works fine however what I want to do is add all the value strings inside of the UL from the bottom of backstagefunctions.php file to my mysql insert query so it'll insert those values into the DB field. How do I do that? Quote Link to comment 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.