Jump to content
skyhighweb

hiding a value

Recommended Posts

hi how do i hide the (team_id) value in the below form

<option value="' . $row['team_id'] . '' . $row['teams'] . '" ' . $selected . '>' . $row['teams'] . '</option>

thanks

 

Share this post


Link to post
Share on other sites
39 minutes ago, dsonesuk said:

????????????? remove $row['team_id']


value="' . $row['teams'] . '"

 

hi i kinda want it to hide

hide as in the code shows result like this

4 Chelsea Chelsea

i want the 4 to hide but still be able to be submitted.

Share this post


Link to post
Share on other sites

Then use delimiter to separate values and send as array of values, then use explode to separate those values by delimiter, and show the value required using index ref

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        $teamRec = "";
        $team_array = [];
        $team_array['Team1'] = ['Team #1 dropdown1', 'Team #1 dropdown2', 'Team #1 dropdown3', 'Team #1 dropdown4'];
        $team_array['Team2'] = ['Team #2 dropdown1', 'Team #2 dropdown2', 'Team #2 dropdown3', 'Team #2 dropdown4'];
        ?>

        <form id="myform" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
            <select name="willwin" class="form-control" onchange="dothis()">
                <option value="">Select Team </option>
                <?php
                $optioncount = 0;
                foreach ($team_array as $key => $value) {
                    $optioncount++;
                    if ($key === $teamRec) {
                        echo '<option class="team' . $optioncount . '" value="' . $key . ', Team #' . $optioncount . '" selected="selected">Team #' . $optioncount . '</option>';
                    } else {
                        echo '<option class="team' . $optioncount . '" value="' . $key . ', Team #' . $optioncount . '">Team #' . $optioncount . '</option>';
                    }
                }
                ?>



            </select><br>
            <?php
            if (isset($_POST['willwin'])) {
                $teamRec = explode(',', $_POST['willwin']);

                echo '1st $_POST["willwin"] value of Response: ' . $teamRec[0] . '<br>';
                echo '2nd $_POST["willwin"] value of Response: ' . $teamRec[1] . '<br>';
            }
            ?>


            <input type="submit">
        </form>

        <script>
            function dothis() {
                x = document.getElementById('myform').submit();

            }


        </script>

    </body>
</html>

 

Share this post


Link to post
Share on other sites
1 hour ago, dsonesuk said:

Then use delimiter to separate values and send as array of values, then use explode to separate those values by delimiter, and show the value required using index ref


<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        $teamRec = "";
        $team_array = [];
        $team_array['Team1'] = ['Team #1 dropdown1', 'Team #1 dropdown2', 'Team #1 dropdown3', 'Team #1 dropdown4'];
        $team_array['Team2'] = ['Team #2 dropdown1', 'Team #2 dropdown2', 'Team #2 dropdown3', 'Team #2 dropdown4'];
        ?>

        <form id="myform" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
            <select name="willwin" class="form-control" onchange="dothis()">
                <option value="">Select Team </option>
                <?php
                $optioncount = 0;
                foreach ($team_array as $key => $value) {
                    $optioncount++;
                    if ($key === $teamRec) {
                        echo '<option class="team' . $optioncount . '" value="' . $key . ', Team #' . $optioncount . '" selected="selected">Team #' . $optioncount . '</option>';
                    } else {
                        echo '<option class="team' . $optioncount . '" value="' . $key . ', Team #' . $optioncount . '">Team #' . $optioncount . '</option>';
                    }
                }
                ?>



            </select><br>
            <?php
            if (isset($_POST['willwin'])) {
                $teamRec = explode(',', $_POST['willwin']);

                echo '1st $_POST["willwin"] value of Response: ' . $teamRec[0] . '<br>';
                echo '2nd $_POST["willwin"] value of Response: ' . $teamRec[1] . '<br>';
            }
            ?>


            <input type="submit">
        </form>

        <script>
            function dothis() {
                x = document.getElementById('myform').submit();

            }


        </script>

    </body>
</html>

 

so this is like an example i believe right

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...

×
×
  • Create New...