Jump to content

Unable to output text depending on option


yobo

Recommended Posts

Hey All,

 

I was wondering if somone could take a look at this for me?

 

What I am trying to do is change the font colour of the text depending on what the user selected

 

for example I have to pages one page that has the code for the radio buttons the other page that processes it

 

now if the user slects the red radio button i want the next page to output the name of the radio button they selected in that colour so being red.

 

my code is shown below

Form Page

<?php 

/** 
* @author Joe Moore 
* @copyright 2009 
*/ 

?> 
<form action="script.php" method="POST"> 
<input type="radio" name="colours" checked value="red"/> Red<br /> 
<input type="radio" name="colours" value="blue"/> Blue<br /> 
<input type="radio" name="colours" value="green"/> Green<br /> 

<input type="submit" value="GO"/> 


</form>

 

Process Page (script.php)

<?php 

/** 
* @author Joe Moore 
* @copyright 2009 
*/ 

echo "<font color="$_POST['colours']"></font>"; 
?>

 

all I get is an error phase error msg

 

 

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.