Hi guys, i need selected option value of a drop down list will refresh index page and change data with row by ID from Database which user choose. It is test for imagine.

hint: number of id = number of question
look at DB - Click Here

i have some code which can maybe help, thanx for every help...

<form action="yourpostedtopage.php" method="post">
<select name="yourselectbox" id="yourselectbox">
            <option value="something1">Option 1</option>
                        <option>Option 2</option>
</select>
<input name="submitbutton" type="submit" value="submit" />
</form>

yourpostedtopage.php

...
$selectedoption = $_POST['yourselectbox'];
...
echo $selectedoption;
mysql_query(".... WHERE column = '$selectedoption' ... ")
...

Recommended Answers

All 4 Replies

please someone i really need solve this problem thx.

I am not invincible. I cannot reply to everyone instantly, because I have an extremely busy social life. Sorry that I couldn't respond to this within 24 hours.

Joke over, I'll stop lying.

If it's urgent, you're in the wrong place. If not, learn patience.

You haven't even asked a question: what is your problem? I assume you want a dropdown which changes the value of a cell in the db. So what's not working for you? Error messages?

it is hard to explain,but i need echo row from db and GIVE TI TO web page.
some easy explain how it should work

<select name="yourselectbox" id="yourselectbox">
            <option value="something1">Option 1</option>
            <option value="something2">Option 2</option>
            <option value="something1">Option 3</option>
</select>

User choose value 2 and webpage will be update with data by 2. row in DB. I have no idea how to do it.
I need some conditions which will ensure it...

-I once had the same problem and 'andrevanzuydam' solved it this way,use ad this onchange="document.forms[0].submit();"function where the line of Your selet control is.
-So on Your account it should look like this:

    <select name="yourselectbox" id="yourselectbox" onchange="document.forms[0].submit();">
    <option value="something1">Option 1</option>
    <option value="something2">Option 2</option>
    <option value="something1">Option 3</option>
    </select>

then in yourpostedtopage.php You can have something like this:

if($_REQUEST["yourselectbox""])
{
$Selected_Value=$_REQUEST["yourselectbox""];

mysql_query(".... WHERE column =".$Selected_Value." ... ")
//I hope from here if You want to load individual values from the table You can filter the Fields based up on the selected row
}

-Give the alert upon progress...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.