Make a select with options that will be saved and variables!

Asked

Viewed 44 times

0

Good morning, I would like to create a code where I have a select with various options and when one of them is selected and the user gives Submit, the string of this option is passed to a variable, can you help me? in the case of the code below I tried to use the angular but I am still beginner, can use any language to select , thank you

<form class="form" method="post" action="date.php">

            <br>
            <div class="input-group">
                <div class="input-group-btn">
                    <input class="btn" type="submit">
                </div>
                <input type="month" class="form-control" name="datac" value="<?php echo $ano ?>-<?php echo $mes ?>" required>
                <div ng-app="myApp" ng-controller="myCtrl">
                    <select ng-model="uni">
                        <option value="BRAZIL" ng-selected="uni=='BRAZIL'">BRAZIL</option>
                        <option value="USA" ng-selected="uni == 'USA'">USA</option>
                        <option value="CANADA" ng-selected="uni == 'CANADA'">CANADA</option>
                        <option value="RUSSIA" ng-selected="uni == 'RUSSIA'">RUSSIA</option>
                    </select>

  • 1

    Have you come to take a look at Knockoutjs

  • No, I’ll look now

  • Hello, I don’t quite understand your question. Do you simply want the value selected in the form to be passed to the server? or the value of select being a javascript variable for later use? you already use angular in your project or inserted it only for this functionality?

  • Calm down, I tried to do angular but it didn’t work, forget the angular part, I want to select a select option and when I give Submit the value of this option goes to a php variable, got?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.