Hi guys,
I'm wondering if anyone can help. I have surryussface flu and I just can't seem to concentrate at all.
I need to be able to select a colour from a list like the attached image. I've managed to code it right up to the part where it can show you the colour you currently have selected.
But I don't know what the hell I need to do to be able to click a colour and have it just refresh the page (or in this case, the "mainFrame" frame) as a result of updating the database. Here's some code and stuff!
<form name="selectColour" method="post" action="">
<table width="30%" align="center" border="0">
<tr>
<td colspan="8" align="center" valign="top" height="50">
<font face="Verdana" size="2">Select a colour for your PDF Documents. <i><a onclick="$.jGrowl('<b>PDF Layout Colour Selector</b><br /><br />You can select the colour of the PDF Layouts here, by clicking a colour swatch below. <br><br>These colour changes <i>only</i> change the colour of the title header sections of each document. <br><br>All your documents will be the same colour. You cannot change the text colour on documents.', { sticky: true });" href="javascript:void(0);">(?)</a></i></font>
</td>
</tr>
<tr>
<td>
<a onclick="selectColour('<?php $colour = "#000000"; ?>');"><img src="/images/colours/000000.png" border="0">
</td>
<td>
<a onclick="selectColour('<?php $colour = "#333333"; ?>');"><img src="/images/colours/333333.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#6e0000');"><img src="/images/colours/6e0000.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#966c1a');"><img src="/images/colours/966c1a.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#232163');"><img src="/images/colours/232163.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#0400b4');"><img src="/images/colours/0400b4.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#5f01c9');"><img src="/images/colours/5f01c9.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#4c54ff');"><img src="/images/colours/4c54ff.png" border="0"></a>
</td>
</tr>
<tr>
<td>
<a onclick="selectColour('#00a2ff');"><img src="/images/colours/00a2ff.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#02d0d2');"><img src="/images/colours/02d0d2.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#8e61c2');"><img src="/images/colours/8e61c2.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#00ac51');"><img src="/images/colours/00ac51.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#10e000');"><img src="/images/colours/10e000.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#00ff78');"><img src="/images/colours/00ff78.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#e30000');"><img src="/images/colours/e30000.png" border="0"></a>
</td>
<td>
<a onclick="selectColour('#ffa800');"><img src="/images/colours/ffa800.png" border="0"></a>
</td>
</tr>
<input type="hidden" name="#000000">
<input type="hidden" name="#333333">
<input type="hidden" name="#6e0000">
<input type="hidden" name="#966c1a">
<input type="hidden" name="#232163">
<input type="hidden" name="#0400b4">
<input type="hidden" name="#5f01c9">
<input type="hidden" name="#4c54ff">
<input type="hidden" name="#00a2ff">
<input type="hidden" name="#02d0d2">
<input type="hidden" name="#8e61c2">
<input type="hidden" name="#00ac51">
<input type="hidden" name="#10e000">
<input type="hidden" name="#00ff78">
<input type="hidden" name="#e30000">
<input type="hidden" name="#ffa800">
<?php
if ($selectColour) {
$sql = "UPDATE conf_settings SET pdfcolour = '$colour' WHERE client = '$userclient'";
$query = mysql_query($sql);
}
//Get current colour of layouts.
$sql = "SELECT pdfcolour FROM conf_settings WHERE client = '$userclient'";
$query = mysql_query($sql);
$colourhex = mysql_fetch_row($query);
$currentcolour = ltrim($colourhex[0], "#");
echo "<tr><td colspan='8' align='center' valign='bottom' height='90'>";
echo "<font size='2' face='Verdana'>Your current PDF Layout colour is:</font><br /><img src='/images/colours/".$currentcolour.".png' border='0'>";
echo "</td></tr>";
?>
I would be MORE than happy to just have the image be clicked and update the database with ANYTHING! I can figure out getting the right data no problem... I just literally need the onClick to run through some JS (which I'm terrible with) posting to the same PHP file, which updates the database field. But with being ill and stuff, it's thrashing my head! :(
Anyone? /beg! :)
edit: as you can see, I've tried putting some php in the onclick for the first two colours... didn't work >_<