Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Account Settings using <select>
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Synapse" data-source="post: 431665" data-attributes="member: 13644"><p><a href="https://stackoverflow.com/questions/17139501/using-post-to-get-select-option-value-from-html" target="_blank">https://stackoverflow.com/questions/17139501/using-post-to-get-select-option-value-from-html</a></p><p></p><p>[code]</p><p><?php</p><p>if(isset($_POST['toggleTrading'])) {</p><p> if($_POST['toggleTrading'] != 0 AND $_POST['toggleTrading'] != 1){</p><p> // bad data about to be submitted, escape it</p><p> die("Unable to post that to database");</p><p> }</p><p> else {</p><p> //update row</p><p> }</p><p></p><p>}</p><p>?></p><p><p></p><p> <label></p><p> Setting:</p><p> <select name="toggleTrading"></p><p> <option value="1">Enable Trading</option></p><p> <option value="0">Disable Trading</option></p><p> </select></p><p> </label></p><p></p></p><p><p></p><p> <label></p><p> Setting:</p><p> <input type="text" name="acc_trade" size="32" maxlength="32" value="{acc_trade}" id="avatarmotto"></p><p> </label></p><p></p></p><p>[/code]</p><p></p><p>The code you want would look similar to this. My PHP skills are kind of bad however, sure there are better implementations.</p><p></p><p>Edit: forgot the semi colon, Python got me messin up.</p></blockquote><p></p>
[QUOTE="Synapse, post: 431665, member: 13644"] [URL]https://stackoverflow.com/questions/17139501/using-post-to-get-select-option-value-from-html[/URL] [code] <?php if(isset($_POST['toggleTrading'])) { if($_POST['toggleTrading'] != 0 AND $_POST['toggleTrading'] != 1){ // bad data about to be submitted, escape it die("Unable to post that to database"); } else { //update row } } ?> <p> <label> Setting: <select name="toggleTrading"> <option value="1">Enable Trading</option> <option value="0">Disable Trading</option> </select> </label> </p> <p> <label> Setting: <input type="text" name="acc_trade" size="32" maxlength="32" value="{acc_trade}" id="avatarmotto"> </label> </p> [/code] The code you want would look similar to this. My PHP skills are kind of bad however, sure there are better implementations. Edit: forgot the semi colon, Python got me messin up. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Account Settings using <select>
Top