I have a few php pages designed to search the database for promotion codes I created in the admin panel
I am struggling to echo these codes out to the promotional pages
my advert is simple
advert.php
<body>
<div>
<!-- Start SPECIAL OFFER/PROMO -->
<div id="specialPromo" class="specialPromo">
<p class="promoTitle">promotion title!</p>
<p class="promoText">here is our promotion code</p>
<div class="promoCodeBox">
<!-- PROMO CODE -->
<p class="promoCode"><?echo $showcode?></p>
<!-- PROMO CODE -->
</div>
<div class="promoBtn"><a class="cupid-green" href="index.php?action=signup">JOIN NOW</div></a></div>
<!-- End SPECIAL OFFER/PROMO -->
</div>
</body>
</html>
this then links to another page
getcode.php
<?
include ("include/universal.php");
//execute the SQL query and return records
$result = mysql_query("SELECT discount_code FROM discount_codes WHERE discount_name='".$code."'");
//fetch tha data from the database
while ($row = mysql_fetch_array($result))
{
$showcode = ($row{'discount_code'});
}
//close the connection
mysql_close($condb);
?>
the problem lies with this bit of code
$code = $code["code1"];
works fine and gets results if I place it in the getcodes.php
but I want to place it in the advert.php
ultimately the plan would be to create a single admin page where I can select an advert and input the codename and it will auto-populate the code to be used with in that advert
but I cant even get it to work with a single advert, unti I figure that out I have no chance of administrating multiple adds from a single page
any advice please as to where I am going wrong, bear in mind I have only been using php for 2 weeks now
thank you all for your advice in advance