I’m building an SEO script and am delaying this matter for 2 weeks now without an answer. I saw dozens of answers here but none of them where satisfactory (or at least I didn’t find them useful).
I have a MySQL table with several fields, the data base has the keyword field as primary and the other fields are SEO variables for the keyword in question. OK, no problem, I put the MySQL values in the table and they are spit out into a nice table when requested by php…
I have a round button at the beginning of every row that indicates if the keyword is easy, medium or hard to optimize. Respectfully a green button, an orange button and a red button. Only one shows per row.
The color is determined by the Page Rank (a column in the table, from 0-10 (<2 – green, 2-4 orange, over 4 red)).
So my problem is simple…
I would like to click on these buttons, images or what you would like to call them and select them, they will turn blue (REPLACE THE IMAGE WITH A BLUE IMAGE) so then they can be included in the .CSV file to export.
So, I would show you the code I have but I have changed it so many times I don’t think it’s any good and not significant, but I can answer any questions.
Basically it’s changing 2 images back and forth with mysql and php on an ONCLICK basis.
It's half in Portuguese so I will translate...
$query = "SELECT `CÔR`(COLOR), `keyword`, `Adds`, `PRMédio`, `PRDomínioMédio`, `Searches`, `CPC`, `.com`, `.org`, `.net`, `All in URL`, `All in Title`, `All in Desc.` FROM keywords";
if ($query_run = mysql_query($query)) {
while ($query_row = mysql_fetch_assoc($query_run)) {
(COLOR)$côr = $query_row['CÔR'];
$keyword = $query_row['keyword'];
$Adds = $query_row['Adds'];
$PRMédio = $query_row['PRMédio'];
$PRDomínioMédio = $query_row['PRDomínioMédio'];
$Searches = $query_row['Searches'];
$CPC = $query_row['CPC'];
$com = $query_row['.com'];
$org = $query_row['.org'];
$net = $query_row['.net'];
$All_in_URL = $query_row['All in URL'];
$All_in_Title = $query_row['All in Title'];
$All_in_Desc = $query_row['All in Desc.'];
echo "
<tr>
<th>";
if ($PRMédio < 2) {
echo "(GREEN BUTTON)$botao_verde";
} else if ((2 <= $PRMédio) && ($PRMédio < 4)) {
echo "(ORANGE BUTTON)$botao_laranja";
} else if (4 < $PRMédio) {
echo "(RED BUTTON)$botao_vermelho";
}
// this is the part where i do not know what I'm doing
echo "<form>
<input type='submit' name='submit' class='image'
value=(BUTTON)'botão' onClick='UPDATE keywords SET CÔR = ~CÔR'>";
echo "</form>
</th>
<td>$keyword</td>
<td>$Adds</td>
<td>
It continues with the rest of the columns of the table...