Goeiedag;
Ik heb dit scripje maar nu wil ik de waarde meesturen in de cookie en dan ook weer opvragen.
Hier is het script;
<?php
if ($_POST['bg'])
{
$Achtergrond = $_POST['bg'];
if ($_POST['bg'] == 'Achtergrond 1')
{
setcookie("Achtergrond", $Achtergrond, $Testtext);
}
if ($_POST['bg'] == 'Achtergrond 2')
{
setcookie("Achtergrond", $Achtergrond, $Testtext);
}
if ($_POST['bg'] == 'Achtergrond 3')
{
setcookie("Achtergrond", $Achtergrond, $Testtext);
}
}
?>
<html>
<head>
<title>Edit page</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
if(isset($_COOKIE['Achtergrond']))
{
$bg = $_COOKIE['Achtergrond'];
}
if (isset($bg))
{
if ($bg == 'Achtergrond 2')
{
echo '<style type="text/css">' .
'body { background-image: url(http://cache.hyves-static.net/images/pimp/onder_water_thumbsmall.jpg);'; . 'background-repeat: no-repeat;' . 'background-position: center;' . 'background-position: top;}' . '</style>';
}
if ($bg == 'Achtergrond 3')
{
echo '<style type="text/css">' . 'body { background-image: url(http://cache.hyves-static.net/images/pimp/city_by_night_thumbsmall.jpg);'; . 'background-repeat: no-repeat;' . 'background-position: center;' . 'background-position: top;}' . '</style>';
}
if ($bg == 'Achtergrond 1')
{
echo '<style type="text/css">' .
'body { background-image: url(http://cache2.hyves-static.net/images/pimp/into_the_wild_thumbsmall.jpg);'; . 'background-repeat: no-repeat;' . 'background-position: center;' . 'background-position: top;}' . '</style>';
}
}
?>
</head>
<body>
<form method="POST" action="proefje.php">
<table align="center">
<tr><td>
<div id="bg"><table border="1" width="500" height="100">
<tr><td>
</td></tr>
</table>
</td></tr>
<tr><td>
<table border="1" width="500px" height="30px">
<tr>
<td align="center"><input type="radio" name="bg" value="Achtergrond 1">
<label>Radio</label></td>
<td align="center"><input type="radio" name="bg" value="Achtergrond 2">
Radio</td>
<td align="center"><label>
<input type="radio" name="bg" value="Achtergrond 3">
Radio</label></td>
</tr>
<tr><td align="center">
<p>
<label></label>
<br>
<label></label>
<label><a href="http://www.starturs.nl/achtergrond/index.php" target="_self">Terug</a></label>
<br>
<label></label>
<br>
</p>
</td>
<td align="center"><label>Naam;
<input type="text" name="Naam" id="Testtext">
<br>
</label></td>
<td align="center">
<input type="submit" value="Opslaan"> </td></tr>
</table>
</td></tr>
</table>
</form>
</body>
</html>
Hoe kan ik dat doen?
Graag met voorbeeltje.
Bedankt alvast
389 views