Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread Chris
Chris Grigor wrote: morning all, Is there an easier way of doing the following?? form1 submitting to form1.php input type=checkbox name=1 input type=checkbox name=2 input type=submit make this into: input type=checkbox name=blah[1] value=1 input type=checkbox name=blah[2] value=1 then you

Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread Peter Hoskin
Chris Grigor wrote: morning all, Is there an easier way of doing the following?? form1 submitting to form1.php input type=checkbox name=1 input type=checkbox name=2 input type=submit form1.php ?php $link = mysql_connect('host', 'user', 'pass') or die (Connection failed: .

Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread viraj
definitely a loop will do the job. on a form submission, you can get all the submitted fields/ values in $_POST or $_GET array. just, try 'print_r($_POST)', on top of your receiving script. you will realise the scene behind. :) then, get the size of the $_POST array and loop through the array

Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread Angelo Zanetti
Peter Hoskin wrote: Chris Grigor wrote: morning all, Is there an easier way of doing the following?? form1 submitting to form1.php input type=checkbox name=1 input type=checkbox name=2 input type=submit form1.php ?php $link = mysql_connect('host', 'user', 'pass') or die (Connection

Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread Chris
Chris Grigor wrote: Hi Chris While this works, it only posts the checkboxes that have been selected. How would I get a list of ones not checked? Always reply to the list as well. Checkboxes aren't submitted if they are not checked. It's not a PHP thing that does this. That's why you

Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread tedd
At 10:49 AM +0200 5/10/06, Chris Grigor wrote: morning all, Is there an easier way of doing the following?? Try: http://www.weberdev.com/get_example-3754.html HTH's tedd -- http://sperling.com -- PHP General

Re: [PHP] Is there an easier way of doing this?

2006-05-10 Thread Richard Lynch
for ($i = 1; $i = 20; $i++){ if (isset($_POST[$i])){ //insert blah blah blah } } Also, I don't think '1' is valid NAME for HTML specification. You could use: NAME=menu[1] Then in PHP: $menu = $_POST['menu']; for ($i = 1; $i = 20; $i++){ if (isset($menu[$i])){ } } And, of

RE: [PHP] Is there an easier way?

2003-07-31 Thread Jennifer Goodie
if(!($rs = mysql_query($q))) // querying { echo Query failed. mysql_error(); exit; } $n = 0; while ($line = mysql_fetch_assoc($rs)) { //dumping into an array foreach ($line as $field = $value) { $data[$field][$n] = $value; } $n++; } and this is how i use

Re: [PHP] Is there an easier way?

2003-07-31 Thread David Nicholson
Hello, This is a reply to an e-mail that you wrote on Fri, 1 Aug 2003 at 02:04, lines prefixed by '' were originally written by you. Hi, This is what i am doing, querying a database via a select statement (getting max 5 records), then dumping everything into an associative array. And then

Re: [PHP] Is there an easier way?

2003-07-31 Thread Joona Kulmala
Ryan A wrote: The problem is I have 38 fields and i can get upto 5 records that means i will end up with over 150 of these statements: $blahn=$data['blah'][n]; and since i dont want to go all over my script saying echo $data['blah'][n]; is there an easier way to avoid the 150 possible