Jump to content

Lua Learner Help


strategos

Recommended Posts

Hi, I'm new to PHP and testing a simple script. However, it won't change to red when I input the red radio button. Would anyone happen to know why?

 

<?php

$check = $_POST['check'];

$submit = $_POST['S1'];

if ($check = "1") {
$color = "green";
}
elseif ($check = "2") {
$color = "red";
}

var_dump($check);

?>

<html>
<body>
<h1 style="color:<?php echo $color; ?>;">The h1 is <?php echo $color; ?>!</h1>
<form method="POST" action="test.php">
<input type="radio" value="1" name="check" /> Green <br />
<input type="radio" value="2" name="check" /> Red <br /><br />
<input type="submit" name="S1" value="submit" />
</form>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/259893-lua-learner-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.