View Full Version : Drop down menu for background change
masterofollies
11-07-2005, 08:40 PM
Ok this may be easy or really hard and im not sure how to do this because im still a beginner with php. I made this option for my game www.creativeskateboardteam.com/choices.html
I want to be able to have it where when a user clicks a choice it auto loads it on that page where the white is. Loads the image tiled for background, then, When they click Apply it changes the file in primary.php and babblebox.php to that background image for them and not the whole game. In primary.php the background is set like this
body {
background-image: url(images/test.jpg);
Any ideas how to get this to work?
skky1142
11-07-2005, 09:39 PM
Have you thought about using sessions to set the background color... as opposed to setting it up in a file? Also, if there is no session present you can set the default background to be white. It wouldn't be too difficult using sessions.
How new to php are you?
masterofollies
11-07-2005, 11:04 PM
Still really new to it. I understand some stuff and can do some modifying, just can't write my own scripts without help except for those easy hello world Examples. How would a session work? and also I wish the background to stay the same on everyone elses computer and only change it on the person who is changing it,
masterofollies
11-08-2005, 02:38 AM
Ok can you tell me whats wrong with this?? it says parse error ';' on line 19
<form>
<select name="bgchange">
<option value="0">Select Background
<option value="1">Choice 1
<option value="2">Choice 2
<option value="3">Choice 3
<option value="4">Choice 4
<option value="5">Choice 5
<option value="6">Choice 6
<option value="7">Choice 7
<option value="8">Choice 8
<option value="9">Choice 9
</select>
</form>
<?php
if($_POST['bgchange'] == 1); {
background-image: url(images/choice1.jpg)
}
if($_POST['bgchange'] == 2); {
background-image: url(images/choice2.jpg)
}
if($_POST['bgchange'] == 3); {
background-image: url(images/choice3.jpg)
}
if($_POST['bgchange'] == 4); {
background-image: url(images/choice4.jpg)
}
if($_POST['bgchange'] == 5); {
background-image: url(images/choice5.jpg)
}
if($_POST['bgchange'] == 6); {
background-image: url(images/choice6.jpg)
}
if($_POST['bgchange'] == 7); {
background-image: url(images/choice7.jpg)
}
if($_POST['bgchange'] == 8); {
background-image: url(images/choice8.jpg)
}
if($_POST['bgchange'] == 9); {
background-image: url(images/choice9.jpg)
}
if($_POST['bgchange'] == 0); {
background-image: url(images/Default.jpg) // Fill Default with the default image
} ?>
Rich Pedley
11-08-2005, 09:34 AM
line 19 is background-image: url(images/choice1.jpg) that isn't a php command, it is actually a bit of CSS.
I don't know how to set this up with sessions but know it can be done with javascript.
masterofollies
11-08-2005, 05:22 PM
Hmm.... yeah its CSS maybe it can't be done, I wish I knew javascript. Anyone else can you help me???
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.