Xtremer360 Posted January 9, 2009 Share Posted January 9, 2009 What I want to happen is near the bottom of this function. The UL part. I want the default to be "This handler does not have any characters assigned." until a character name is put into the UL then it only leaves the submitted character names. function newhandler() { if (isset ( $_POST ['submit2'] )) { // Handle the form. // 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 (); } print '<h1 class="backstage">Handler Management</h1><br />'; print '<h2 class="backstage">Add New Handler Account</h2><br />'; print '<form name="newhandler" method="post">'; 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">'; print '<option value="Enabled">Enabled</option><option value="Disabled">Disabled</option>'; print '</select></td>'; print '</tr>'; print '<tr>'; print '<td class="rowheading">Administrator:</td>'; print '<td class="row3"><select name="admin" class="selection">'; 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="submit2"></form><br />'; print '<input type="hidden" name="action" value="handlers"><input type="submit" value="Return to Handler List" class="button200"><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>'; print 'This handler does not have any characters assigned.<br /><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...
AlexGrim Posted January 9, 2009 Share Posted January 9, 2009 If you're talking about setting the default option in the html select list, then this is how to do that: <option value="MyValues" checked>Option Text</option> But i have the feeling that you're asking about something else, which i am totally missing... Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted January 9, 2009 Author Share Posted January 9, 2009 print "<option value="MyValues" checked>This handler does not have any characters assigned.</option>"; says Parse error: syntax error, unexpected T_STRING in /home/content/y/a/n/yankeefaninkc/html/other/backstagefunctions.php on line 132 Quote Link to comment Share on other sites More sharing options...
Xtremer360 Posted January 9, 2009 Author Share Posted January 9, 2009 I just reread your post and yes you are talking about something else. What I want is when the function is loaded the default in the UL will read as This handler does not have any characters assigned. until a character name from the drop down is chosen and submitted to the UL then it replaces that text with the character name. 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.