I've been searching a script that will do this job , but nowhere is.
So , i want to make a script that will extract some data from a table and put it in radio buttons with image and after that with a submit form insert it in another table.
Well , that's what i did so far:
creeaza.php
Code: Select all
<form id="creeaza" name="creeaza" method="post" action="creeaza_tot.php">
<?php
$queryasd = mysql_query("SELECT * FROM creeaza_tip_guler ORDER BY ID ASC;");
while($row = mysql_fetch_array($queryasd))
{
$id = $row['ID'];
$nume = $row['nume'];
$baza= addslashes($row['poza']);
$poza= "creeaza/" . $baza;
echo '<table width="100" border="0" cellspacing="0" cellpadding="0" style="float: left;">
<tr>
<td>
<div align="center">';
echo '<INPUT TYPE=RADIO NAME="rad" VALUE="' . $nume . '">' . $nume . '<BR>';
echo '</div>
</td>
<td rowspan="2"> </td>
</tr>
<tr>
<td>';
echo "<div align=\"center\"><img src=\"$poza\"";
echo ' alt="" width="112" height="112" /><br /></td></div></tr></table>';
}
?>
<input type="submit" name="creeaza_submit" id="creeaza_submit" value="CREEAZA" />
</form>
Code: Select all
<?php
include('include/connection.php');
$numee = $_POST['rad'];
$pozaa = $_POST['poza'];
$query="INSERT INTO creeaza (nume_guler,poza_guler) VALUES ('$numee','$pozaa');";
mysql_query($query) or die ('Eroare la adaugat');
echo "<a href=creeaza.php>";
echo "APASA AICI - click aici";
echo "</a>";
?>
And when i press "creeaza" to put the name tes2 and the picture for tes2 in the creeaza table.
PS:
I have 2 tables :
1. creeaza_tip_guler [ID,nume,poza]
2. creeaza [ID, nume_guler , poza_guler]
How can i make those radio buttons , to show in the creeaza table the correct picture for respective name and radio button?
Please , anybody!