Jump to content

Working with options and submits


Nekokan
Go to solution Solved by Nekokan,

Recommended Posts

Hello,

I am newbie in PHP, but I'm trying to learn and code things for web sites...

I got a doubt on following code for a deletion character:

<form action="" method="post">

<select id="selected_character" name="selected_character" class="form-control" style="width:180px;height:30px">

<?php
echo '<option value="'. $value['name'] . '">'. $value['name'] .'</option>';
?>

</select>
						
						
<select id="action" name="action" class="form-control" onChange="changedOption(this)" style="width:180px;height:30px">
								
<option value="delete_character">delete</option>
<class="delete_character"><input type="image" src="img/deletechar.png"<img style="max-height: 15px;"onclick="return confirm('Do you want to delete the adventurer?\notro test');" >
				

</form>

 

And the web output is shown like this:

Quote

[ NAME ] +  [ delete ] +  deletechar.png

Character data is coming from $value. My goal here would be to hide the selection for NAME and delete values, so when you click the png option it already points to current position.

I think now I may use a different class that it is not option or post...

 

Any help with this?

Link to comment
Share on other sites

If it helps I got:

			// DELETE character
			case 'delete_character':
				if (user_character_account_id($char_name) === $session_user_id) {
					$charid = user_character_id($char_name);
					if ($charid !== false) {
						if ($config['ServerEngine'] === 'TFS_10') {
							if (!user_is_online_10($charid)) {
								if (guild_leader_gid($charid) === false) user_delete_character_soft($charid);
								else echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
							} else echo 'Character must be offline first.';
						} else {
							$chr_data = user_character_data($charid, 'online');
							if ($chr_data['online'] != 1) {
								if (guild_leader_gid($charid) === false) user_delete_character_soft($charid);
								else echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
							} else echo 'Character must be offline first.';
						}
					}
				}
				break;
			// end

for the catch function that handles the post:

if (!empty($_POST['selected_character'])) {
	if (!empty($_POST['action'])) {
		// Validate that post has been done and proceed with the checks

 

Link to comment
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.