Jump to content

Recommended Posts

When the page loads I want the default to say in the UL that "This handler does not have any characters assigned." until a characterid is selected from the drop down and added to the ul then it replaces the phrase. What do I need to change?

 

	print '<h2 class="backstage">Characters<br /><br />';
    print '<form method=post name="addwrestler" onsubmit="return WrestlerList(this);">';
    $query = 'SELECT charactername FROM characters';
print'<select name="characterid" class="dropdown">';
print '<option value="">- Select -</option>';
    $result = mysql_query ( $query );
        while ( $row = mysql_fetch_assoc ( $result ) ) {
        print "<option value=\"".$row['charactername']."\">".$row['charactername']."</option>\r";
        
    }
print '</select>';
print'  <input name="submit" type="button" value="Add" class="button"></form></h2><br />'; 
{
print 'This handler does not have any characters assigned.<br /><br />';
}
else {     
    print '<ul id="characterlist"></ul>';  
print '<h2 class="backstage"><form method="post"><input type="submit" value="Return to Main Menu" class="button200"></form></h2>';
}

Link to comment
https://forums.phpfreaks.com/topic/140395-changing-default/
Share on other sites

I'm sort of guessing about what you want, because your question is not very clear. If you want the phrase to change when somebody selects an option, then you're going to use javascript to replace the innerHTML of an elements ID (which you access by getElementByID()). You will need to use an event handler to have javascript do this. This is simple stuff. Good luck.

Link to comment
https://forums.phpfreaks.com/topic/140395-changing-default/#findComment-734839
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.