Ok heres basically what I want to do. I want to update a specific image. basically I want to in my admin panel that I have, have a drop down box. and in that drop down box there are 5 things. Level 1,Level 2,Level 3,Level 4,Level 5.
Basically this.
<option>Level 1</option>
<option>Level 2</option>
<option>Level 3</option>
<option>Level 4</option>
<option>Level 5</option>
then what I want it to do is on the main page, (i.e. index.php)
I want it to change to the picture thats assigned to that option. Basicaly there a small graphic thats in a specific area (whever its placed) and when the option is updated in the admin panel it changes to the assigned picuture.
example of assigned pic
<option>Level 1</option> level1.png
<option>Level 2</option> level2.png
<option>Level 3</option> level3.png
<option>Level 4</option> level4.png
<option>Level 5</option> level5.png
and of course it would haev to be related to a mysql field and the table row would be called
slvl
Help creating a php code
Moderator: General Moderators
Re: Help creating a php code
I think what your trying to get at is making the <form> that you have your dropdown list in send to the same page ie $PHP_SELF -
Then you'll have the result of your form stored in $_POST - which you'll then need to write a bit of code which reacts to which ever result is given ie.
Hope that helps
Then you'll have the result of your form stored in $_POST - which you'll then need to write a bit of code which reacts to which ever result is given ie.
Code: Select all
if ($_POST['img1']){
echo '<img src="img1.jpg">';
}
elseif($_POST['img2']){
echo '<img src="img2.jpg">';
}
Re: Help creating a php code
What is the name of your <select> tag?
ie <select name="?">
ie <select name="?">