Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello
I want to do a php page that prrform a function depending on html selection
HTML code
HTML
Service:<select name="service" size="1">
<option>New Code</option>
<option>Delete Code</option>
<option>Add Credits</option>
<option>Check Credit</option>
</select>

PHP code;
PHP
$service=$_REQUEST['service'];
if ($service="new code"){newcode();}
elseif ($service="delte code"){deletecode();}
function newcode()
{
echo("New Code");
} 
function deletecode()
{
echo("Delete Code");

If i choose new code or delete code i get on the PHP page Echo with mew code
Please help
Thanks in advance
Posted
Comments
Manfred Rudolf Bihy 6-May-12 13:51pm    
What is the problem? You forgot to ask a question and did not tell us what exactly is going wrong.
Rakesh S S 7-May-12 12:23pm    
Problem is not simple unless and untill it is solved lol :D

1 solution

PHP
if ($service="new code"){newcode();}
elseif ($service="delte code"){deletecode();}


Check this both the lines you are not comparing you assigned the value which returns true.

modified code.

PHP
if ($service=="new code"){newcode();}
elseif ($service=="delte code"){deletecode();}
 
Share this answer
 
Comments
Seif Hatem 9-May-12 14:01pm    
Thank you very much :)
Loke.mysore 10-May-12 0:26am    
you are welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900