im creating a website that will be mostly powered by php. I will start by giving you some backgroound:
I want the website to be totally dependant, so the user can update it all themselves.. upload new images,select which to show etc.!
the first hurdle ive hit is that i want the 'admin' to be able to select what banner is shown on the page depending on what time of year it is.
for instance in the admin section that i will create there will be a section for 'site content' a sub section with here will be banners. through the use of a drop down box filled with details from a table... i want the user to manually select what banner to display on the site.
what ive done so far:
ive created the databas, and a realy basic admin part, ive currently got 2 records in the database, pointing to 2 banners. on the one page ive got the banner showing and on the other ive created a drop down menu which reads the field in the table which describes the banner, so from this drop down menu i want the user to be able to select what banner they want to use, click update, and the banner being used will be changed....
my code for the 2 pages:
admin page (what people can see)
Expand|Select|Wrap|Line Numbers
- <?PHP
- // connection to database
- include "php/constants/dbcnx.php";
- ?>
- </head>
- <body>
- <?PHP
- include ("php/library/listboxfromfield.php");
- ?>
- <table border = 1>
- <tr>
- <td><p> you are currenty using the<b> <?PHP echo $value;?></b> banner</p>
- </td>
- </tr>
- </table>
Expand|Select|Wrap|Line Numbers
- <?PHP
- $query = "SELECT Img_season FROM sitecontent";
- $result = mysql_query($query);
- print "<SELECT name=item>";
- while ($line = mysql_fetch_array($result))
- {
- foreach ($line as $value)
- {
- print "<option value = '$value'";
- }
- print "> $value </option>";
- }
- print "</SELECT>";
- ?>