alapimba Posted January 29, 2009 Share Posted January 29, 2009 Hello, I need to design a form to order some items. The items list come from a mySQL database. And for each item i need to have one text field (to choose the quantity and i guess a checkbox so the user can choose what they want) This is sounds confusing even for me ??? Anyone can tell me whats the best way to do this? i have the list of items and i need to let the user choose which ones they want and how many for each one. I had only a checkox and the code was like this: <?php do { ?><tr> <td align="right"><label> <input name="check[]" type="checkbox" id="checkbox" value="<?php echo $row_rs_manuais['titulo']; ?>" /> </label></td> <td><?php echo $row_rs_manuais['titulo']; ?></td> </tr> <?php } while ($row_rs_manuais = mysql_fetch_assoc($rs_manuais)); ?> .... foreach($_POST['check'] as $value) { $check_msg .= "$value\n"; } $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers = "From: " . $_POST['nome'] . " <" . $_POST['email'] . ">\r\n"; $body = "From: $nome\nE-Mail: $email\nMorada: $morada\nCodigo Postal: $cod1-$cod2 $localidade\nTelefone: $telefone\nFax: $fax\nEmpresa: $empresa\nNumero de Contribuinte: $contribuinte\n\nManuais Encomendados:\n$check_msg"; Quote Link to comment Share on other sites More sharing options...
alapimba Posted February 3, 2009 Author Share Posted February 3, 2009 no one can help me? :'( Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted February 3, 2009 Share Posted February 3, 2009 I wrote a tutorial on doing this kind of thing: http://www.phpfreaks.com/tutorial/working-with-checkboxes-and-a-database See if you can follow that. It shouldn't be too hard to apply it to your situation. Quote Link to comment Share on other sites More sharing options...
alapimba Posted February 3, 2009 Author Share Posted February 3, 2009 i read your tutorial but didn't realise how to use it to my needs :/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.