Jump to content
bubbles

PHP checkbox POST

Recommended Posts

Am urmatorul cod :

<?php

if ($_POST['pret_total'])
{
$checked = $_POST['produs'];
if (!$checked) { $totalprice='Nu ati selectat produse';} else {

foreach($checked as $item) {

$totalprice+=$item;
$totalprice.=' lei';
}
}
}

$result = mysql_query("SELECT * FROM produse");
while($row = mysql_fetch_array($result))
{
echo "
<tr>
<td width='200px' align='center'>
<img width='50px' style='border:1px solid #909090;' src='images/products/".$row['id'].".jpg'></td>
<td width='300px' align='center'>".$row['nume']."</td>
<td width='300px' align='center'>".$row['pret']." lei</td>
<td width='50px' align='center'><input type='checkbox' name='produs[]' value='".$row['pret']."' ></td>
</tr>";
}

?>

Cum as putea face ca produsele selectate sa imi mai apara inca o data pe pagina ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...