![]() |
|
| |||||||
| Notices |
| mySQL & PHP Discussions, information and help with mySQL and PHP. |
![]() |
| | LinkBack | Thread Tools |
|
#1
| ||||
| ||||
| Hello dear colleagues from the VH forum, Can someone make me the big favour of explaining how we can put a check box inside of a table ? I mean this when You are listing (for example) Your customers in the screen after a "select" sentence. I would like to give the opportunity to the user to check the box on the chosen customer/line, in which he wants to perform an operation, which could be chosen from a series of buttons at the end of the listing. Hope it's clear, Thanks for all the answers, pipesportugal |
|
#2
| ||||
| ||||
| So to make sure I get you right... you want list all of your customers in a table, each customer on a row, and it just lists down the page. On each row you want to have a check box next to each customer name, and finally at the end of the list have the buttons to perform whatever action on all customers who checkbox was checked?
__________________ Freelance web programming Do you need help installing a script, or need one written for you? I do freelance web programming (XHTML, CSS, PHP, MySQL). Feel free to contact me through my website and I will get back to you with a quote asap. Register/Login Script Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script |
|
#3
| ||||
| ||||
| Yes, that's it Watdaflip, Like in the phpmyadmin after You check the box You have then below some buttons where You can decide to edit, delete, etc make, an operation to the chosen line. On a table, to make a link is very easy because You add the customer number to the link, such as: edit_client.php?client=$client_number, right? But for a checked box how do I know the customer number ? Thanks for replying, pipesportugal |
|
#4
| ||||
| ||||
| Basically you just set the name of each check box to be... for instance "customer[]", which makes it into an array. Set the value of each check box to be the row number in the database table. Once submitted you just have to loop through the posted variable as an array, ie PHP Code: If you need any more explanation I will try to go more in depth or write you an example
__________________ Freelance web programming Do you need help installing a script, or need one written for you? I do freelance web programming (XHTML, CSS, PHP, MySQL). Feel free to contact me through my website and I will get back to you with a quote asap. Register/Login Script Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script |
|
#5
| ||||
| ||||
| Hi Watdaflip, I understand Your code. That's the code for retrieving the customer number on the "other side / action program" (after the button submiting). This method will force me to "create" a form, put my listing (everything) inside this form and add a submit button, so that I can pass the array customer[] with the $_POST method to the "action program". I also checked the html source code at the phpmyadmin page and based on what I saw, this is what it must be done in the table: $line = "<td><center><input type=checkbox name=customer[] value=$customer_number id=checkbox1 /></td>"; $line .= "............... This works. I've tested it. But..... I'd like to use several buttons and javascript and the $_GET method in the browser command to execute the required tasks, but I imagine that it must not be possible. In case You have any idea I would very much appreciate the help. Also from my side I will keep my search to evaluate the possibility of doing it without being forced to "construct" the form. Thanks, pipesportugal |
|
#6
| ||||
| ||||
| Hi, In fact for the purpose I wanted is better to use a RadioButton, because this way, only one customer will be chosen. the philosofy would be the same... .... $line .= "<td><center><input type=radio id=RadioButton1 name=customer[] value=$customer_number</td>"; .... But I would still need to put everything inside of a form and add a submit button and so on..... Any ideas ? thanks all, pipesportugal |
|
#7
| ||||
| ||||
| You don't need to construct the main form body. Add the code to the $line variable using a loop, add at the end the ***essary buttons and you are done. Make sure to add the openin <form and closing /form> tags I use the same method (with delete icon and a text box for quantity updting) for my shopping cart. Unless i misread something..
__________________ Navaldesign Logger Lite: Low Cost, Customizable, multifeatured Login script Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more.... Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA! |
|
#8
| ||||
| ||||
| What are you trying to do, this will help so we know what the problem you are running into.
__________________ Freelance web programming Do you need help installing a script, or need one written for you? I do freelance web programming (XHTML, CSS, PHP, MySQL). Feel free to contact me through my website and I will get back to you with a quote asap. Register/Login Script Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script |
|
#9
| ||||
| ||||
| Hi, You make quite a great team! Congrats, I've been able to do it with the form and /form tags and inserted the code manually for the POST method and it works fine. Watdaflip, what You said at Your first post to my thread made me think that You had got it right, at the first time. Thank You guys ! Pipesportugal |