Hello,
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

Member Avatar for diafol

Try some online tutorials on basic forms and php.

S....A...

Member Avatar for diafol

S....A...

?? WHat's that?

Here is what I am trying todo

<?php 
										      	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?

any 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.

Member Avatar for diafol

thanks for not answering.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.