Nekokan Posted January 26, 2023 Share Posted January 26, 2023 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? Quote Link to comment https://forums.phpfreaks.com/topic/315844-working-with-options-and-submits/ Share on other sites More sharing options...
Nekokan Posted January 26, 2023 Author Share Posted January 26, 2023 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 Quote Link to comment https://forums.phpfreaks.com/topic/315844-working-with-options-and-submits/#findComment-1605094 Share on other sites More sharing options...
Barand Posted January 26, 2023 Share Posted January 26, 2023 1 hour ago, Nekokan said: <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');" > Some dodgy html markup in that line. Quote Link to comment https://forums.phpfreaks.com/topic/315844-working-with-options-and-submits/#findComment-1605098 Share on other sites More sharing options...
Solution Nekokan Posted January 27, 2023 Author Solution Share Posted January 27, 2023 Nevermind, I found that if you <td hidden> in the table froms, you can actually send all data to the POST catch without showing info. [Solved] Quote Link to comment https://forums.phpfreaks.com/topic/315844-working-with-options-and-submits/#findComment-1605121 Share on other sites More sharing options...
kicken Posted January 27, 2023 Share Posted January 27, 2023 2 hours ago, Nekokan said: you can actually send all data to the POST catch without showing info. If you want to send data but not show an input then you use input type="hidden" <input type="hidden" name="something" value="hidden"> Quote Link to comment https://forums.phpfreaks.com/topic/315844-working-with-options-and-submits/#findComment-1605128 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.