Im am very new to PHP, Im trying to write a background colour changer that when the form is submitted a new page displays the colour they selected.
Here is the code I have so far. I think the code on this page is ok. The problem I have is I really dont know how to get it working on the second page. .
- Code: Select all
<html>
<head>
<?php
// creates a session that is kept between the pages
session_start();
$white_status='unchecked';
$pink_status='unchecked';
$blue_status='unchecked';
$green_status='unchecked';
if(isset($_POST['SUBMIT1']))
{
$selected_radio = $_POST['color'];
if($selected_radio =='white')
{
$white_status = 'checked';
$color = 'fffff';
}
else if
($selected_radio =='pink')
{
$pink_status = 'checked';
$color = 'FF00FF';
}
else if
($selected_radio =='green')
{
$green_status ='checked';
$color='008000';
}
}
?>
</head>
<body>
<FORM NAME ="form1" METHOD="POST" ACTION="page2.php">
<input type="radio" name="color" value="colour" onClick=document.bgColor=fffff">White
<input type="radio" name="color" value="colour" onClick=document.bgColor=FF00FF">pink
<input type="radio" name="color" value="colour" onClick=document.bgColor=008000">green
</br></br>
<INPUT TYPE ="Submit" Name = "Submit1" VALUE=CHANGECOLOUR>
</FORM>
</html>
any help greatly appreciated


