Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

please help with radio buttons

$
0
0

hello guys, ive made a script to basically execute two different things depending on which radio button is selected:

print"<div style=\"position:absolute;bottom:20px;right:20px;\">";
print"<form method=\"post\" action=\"\">";
print"<input type=\"radio\" name=\"lang\" value=\"English\" >English<br>";
print"<input type=\"radio\" name=\"lang\" value=\"German\">German";
print"<input type=\"submit\" value=\"Change\" />";
print"</form>";
print"</div>";

$myRadio = intval($_POST['lang']);
if ($myRadio == "English") {          

	print"<h1>English</h1>";
	


}elseif ($myRadio == "German") {

	print"<h1>German</h1>";
	
} 

this doesnt work, firstly for some reason it just displays English straight away even though nothing is even ticked yet. and when i do change to "german" and click the button, it doesnt change...

 

 

PLEASE help me guys, how would i make it work.


Viewing all articles
Browse latest Browse all 13200

Trending Articles