I'm building a webpage that allows a user to choose a theme for it. How can I build that based on this suggestion (I have to use SESSION):
<link rel="stylesheet" type="text/css" href="<?php echo $_SESSION['style']?>" />
I've try to make table named 'theme'
on mysql database like this:
id | th_name | link
1 | blue | style.css
2 | back | black.css
3 | pink | pink.css
.................
And my code (not work):
<?php
echo "<form>";
echo "<select>";
$sql = "select * from theme";
foreach ($dbh->query($sql) as $row)
{
?>
<option value="<?php $row['link'] ?>"><?php echo $row['th_name'] ?></option>
<?php
}
echo "</select>";
echo "</form>";
?>
The 1st code is the key. Do you have any solution for this? (using jquery or something....?)