hi, i need to instert a piece of code in my php script but i dont know php so please help me out with it.
i only need a dropdown list with 2 items: the 1st is "show all" and the 2nd is "show active only". then i want the result to be assigned to $filter = (value) like if it's "show all" then it looks like $filter = 1; and if it's "show active only" it looks like $filter = 0;
thanks in advance!
need help on a basic php code
Moderator: General Moderators
Re: need help on a basic php code
Deka87 wrote:hi, i need to instert a piece of code in my php script but i dont know php so please help me out with it.
i only need a dropdown list with 2 items: the 1st is "show all" and the 2nd is "show active only". then i want the result to be assigned to $filter = (value) like if it's "show all" then it looks like $filter = 1; and if it's "show active only" it looks like $filter = 0;
thanks in advance!
ru interested to learn php. if u need the solution u can go through the site w3schools where type the dropdown list in search it will show the example for ur issue ok
Re: need help on a basic php code
yeah i know but you'd not learn chinese to translate a single sentese. anybody can help with the dropdown still?
Re: need help on a basic php code
Here's your one word translation, now you make fit the context of your needs.
Code: Select all
<?php
//Setup data
$name1="show all";
$value1=1;
$name2="search all";
$value=2;
?>
<!- HTML form opening tags -->
<form action="action" method="post">
<select name="option">
<?php
echo "<option value=\"$value1\">$name1</option>\n";
echo "<option value=\"$value2\">$name2</option>\n";
?>
<!- HTML form closing tags -->
</select>
<input type="submit">
</form>