I have a table with 10 rows. each row has 3 columns. column1 is product name column2 is a drop down box with values from 1to10. column3 is a check box. When the checkbox is checked I would like to get the entire row value (product name, quantity) Can anybody help me how can I do this?
Thanks for your help

5 Years
Discussion Span
Last Post by diafol

Here is what I am trying todo

										      	echo "<table id=serTable border=1 width=100%>";
										      	echo "<tr>";
										      	echo "<td>Nom de service</td>";
										      	echo "<td>Quantité</td>";
											echo "<td>Choix</td>";
											echo "</tr>";
											$servicenom = new Services();
										      	$serviceListe = $servicenom->getAllServices();
										      	foreach ($serviceListe as $service){
										      	echo "<tr>";
										      	echo "<input type=hidden name=serId value=".$service->serId.">";
										      	echo "<td>" .$service->serTheme."</td>";
										      	echo "<td>";
										      	echo "<select name=qtySelectSer>";
										      	echo "<option selected=selected>0</option>";
										      	for ($n=0; $n<11; $n++){
											echo "<option value=qty>".$n."</option>";
										      	echo "<select>";
										      	echo "</td>";
										      	echo "<td><input type=checkbox name=choixSer[] value=" . $service->serId ."> </td>";
										      	echo "</tr>";
										      	echo "</table>";

when I try to get checkbox value like this

$qtySer = $_POST['qtySelectSer'];
$qtyProd= $_POST['qtySelectProd'];

if (isset($_POST['choixSer'])) {
    echo "Vous avez choisi service :";
    for ($i = 0, $c = count($_POST['choixSer']); $i < $c; $i++) {
        echo "<br/><b>" . $_POST['choixSer'][$i] . "</b>";
        echo "<br>";

But I am not able to get the corresponding
$qtySer = $_POST;
$qtyProd= $_POST;
Any idea or help?

[B]$qtyProd= $_POST['qtySelectProd'];[/B]

- Where is qtySelectProd in the form ? I don't see that field in the form.
- qtySelectSer, you have only qty value qtySelectSer, check your HTML option value within the loop.

for ($n=0; $n<11; $n++){ echo "<option value=qty>".$n."</option>";


You are right, I have made a mistake. I corrected it, I have changed qty to $n. Initially i wanted to call "product" instead of service so I named it qtySelectProd. It is no more in use. I am able to make out the check box checked or not, but unable to select the corresponding dropdown list values! Thanks for your reply


Thanks guys, i have found the solution by myself. it is easy. actually i am very very new to oop. since no one answered my question, i searched. thanks for not answering.


thanks for not answering.

You're welcome. You did it yourself. Congratulations.

Edited by diafol: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.