Saturday 17 August 2013

How can I change this form into li? PHP

How can I change this form into li? PHP

Hey it looks like I had most the code correct just that it was not
working. I got some suggestions and we did beautify if not dotted a $theme
but the code does not work. I want to convert this form into a li but I am
having some issues, here is the original form:
<?php
$theme1 = business;
$theme2 = modern;
$theme3 = web2;
if(isset($_POST['style']))
{setcookie('style', $_POST['style'], time()+(60*60*24*1000));
$style=$_POST['style'];}
elseif(isset($_COOKIE['style']))
{$style=$_COOKIE['style'];}
else
{$style=$theme1;} ?>
<link href="<?PHP echo $style; ?>.css" rel="stylesheet" type="text/css" />
<select name="style">
<option type="submit" <?php echo "value='$theme1'";if($style ==
$theme1){echo "selected='selected'";}?>><?php echo $theme1; ?></option>
<option type="submit" <?php echo "value='$theme2'";if($style ==
$theme2){echo "selected='selected'";}?>><?php echo $theme2; ?></option>
<option type="submit" <?php echo "value='$theme3'";if($style ==
$theme3){echo "selected='selected'";}?>><?php echo $theme3; ?></option>
</select>
<input type="submit">
</form>
I want to transform this form into a li form where there are not select,
option, or input in the form. I got some of the code but the form is not
changing my value. It looks like I might be missing the if($style..) and
the name"style" somewhere on my li form. Here is my code:
<form action='".$_SERVER['PHP_SELF']."' method='post' id='myForm'>
<li name='style' onclick='myForm.submit();' value='".$theme1."'";
;if($style == $theme1){echo "selected='selected'";};
echo">".$theme1."</li>
</form>
I think I am messing up on the if($style..) and the
name='name'....somewhat I do not think they are being inputted right. How
would I be able to correct the li form to make it functional?

No comments:

Post a Comment