Re: [PHP] making a tutorial

2006-03-17 Thread Sameer N Ingole

Gustav Wiberg wrote:


- Original Message - From: John Taylor-Johnston 
[EMAIL PROTECTED]

To: PHP-General php-general@lists.php.net
Sent: Friday, March 17, 2006 7:51 AM
Subject: [PHP] making a tutorial


I'm making a tutorial and don't really understand how to do this 
myself :)


pWhich of the following pets do have at home:
br /input type=checkbox name=favourite[] value=dogdog
br /input type=checkbox name=favourite[] value=catcat
br /input type=checkbox name=favourite[] value=snakesnake
br /input type=checkbox name=favourite[] value=othersnake
br /input type=checkbox name=favourite[] value=nonenone of 
these

/p

[snip]

I don't know if this works in PHP as well.

It is a checkbox so it won't work without [] in PHP.

Regards,

--
Sameer N. Ingole
Blog: http://weblogic.noroot.org/
---
Better to light one candle than to curse the darkness.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] making a tutorial

2006-03-17 Thread T.Lensselink
Sameer N Ingole said:
 Gustav Wiberg wrote:

 - Original Message - From: John Taylor-Johnston
 [EMAIL PROTECTED]
 To: PHP-General php-general@lists.php.net
 Sent: Friday, March 17, 2006 7:51 AM
 Subject: [PHP] making a tutorial


 I'm making a tutorial and don't really understand how to do this
 myself :)

 pWhich of the following pets do have at home:
 br /input type=checkbox name=favourite[] value=dogdog
 br /input type=checkbox name=favourite[] value=catcat
 br /input type=checkbox name=favourite[] value=snakesnake
 br /input type=checkbox name=favourite[] value=othersnake
 br /input type=checkbox name=favourite[] value=nonenone of
 these
 /p
 [snip]
 I don't know if this works in PHP as well.
 It is a checkbox so it won't work without [] in PHP.

 Regards,

 --
 Sameer N. Ingole
 Blog: http://weblogic.noroot.org/
 ---
 Better to light one candle than to curse the darkness.

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




It will work without []. It will just not be an array.

For checkboxes you could use it without [] but then it would be more like
a radio button. Or you could use it with different names in name=.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] making a tutorial

2006-03-17 Thread George Pitcher
  pWhich of the following pets do have at home:
  br /input type=checkbox name=favourite[] value=dogdog
  br /input type=checkbox name=favourite[] value=catcat
  br /input type=checkbox name=favourite[] value=snakesnake
  br /input type=checkbox name=favourite[] value=othersnake
  br /input type=checkbox name=favourite[] value=nonenone of
  these
  /p
  [snip]
  I don't know if this works in PHP as well.
  It is a checkbox so it won't work without [] in PHP.
 

 It will work without []. It will just not be an array.

 For checkboxes you could use it without [] but then it would be more like
 a radio button. Or you could use it with different names in name=.



Surely parsing the final checkbox would overwrite any previous ones unless
they were clearly identifiable as different.

George

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] making a tutorial

2006-03-17 Thread Barry

George Pitcher wrote:

pWhich of the following pets do have at home:
br /input type=checkbox name=favourite[] value=dogdog
br /input type=checkbox name=favourite[] value=catcat
br /input type=checkbox name=favourite[] value=snakesnake
br /input type=checkbox name=favourite[] value=othersnake
br /input type=checkbox name=favourite[] value=nonenone of
these
/p


[snip]


I don't know if this works in PHP as well.


It is a checkbox so it won't work without [] in PHP.



It will work without []. It will just not be an array.

For checkboxes you could use it without [] but then it would be more like
a radio button. Or you could use it with different names in name=.





Surely parsing the final checkbox would overwrite any previous ones unless
they were clearly identifiable as different.

George

numerize them favourite[1],favourite[2],favourite[3]... and so on

That works!

btw print_r($GLOBALS) would you print out what you got from the Posted 
site with some more values.


Give it a try

Greets
barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] making a tutorial

2006-03-17 Thread Ford, Mike
On 17 March 2006 07:39, Gustav Wiberg wrote:

 - Original Message -
 From: John Taylor-Johnston [EMAIL PROTECTED]
 To: PHP-General php-general@lists.php.net
 Sent: Friday, March 17, 2006 7:51 AM
 Subject: [PHP] making a tutorial
 
 
  I'm making a tutorial and don't really understand how to do this
  myself :) 
  
  pWhich of the following pets do have at home:
  br /input type=checkbox name=favourite[] value=dogdog
  br /input type=checkbox name=favourite[] value=catcat
  br /input type=checkbox name=favourite[] value=snakesnake
  br /input type=checkbox name=favourite[] value=othersnake
  br /input type=checkbox name=favourite[] value=nonenone
  of these /p 
  
  How do I parse favourite[]? I might have 2 or 5, so I need to parse
  ^0] - nMax. It is a checkbox. 
  
  I might use favourite[] with mail() or store it in a mysql field.
  
  If mysql, would I store it in a varchar(20) or an enum() and how?
  
  John
  
  
 Hi there!
 
 Do you have to name it as favourite[]? Can't you name it as just
 favourite (without brackets)

You need [] for it to be an array in PHP -- otherwise you only get one value no 
matter how many are checked.

 If you name it as just favourite, at least in Javascript you could
 loop through favourite as an array. I don't know if this works in PHP
 as well.

It's easy enough to treat it as an array in Javascript with the brackets -- you 
just have to understand the equivalence between objects and arrays.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] making a tutorial

2006-03-16 Thread John Taylor-Johnston

I'm making a tutorial and don't really understand how to do this myself :)

pWhich of the following pets do have at home:
br /input type=checkbox name=favourite[] value=dogdog
br /input type=checkbox name=favourite[] value=catcat
br /input type=checkbox name=favourite[] value=snakesnake
br /input type=checkbox name=favourite[] value=othersnake
br /input type=checkbox name=favourite[] value=nonenone of these
/p

How do I parse favourite[]? I might have 2 or 5, so I need to parse ^0] 
- nMax. It is a checkbox.


I might use favourite[] with mail() or store it in a mysql field.

If mysql, would I store it in a varchar(20) or an enum() and how?

John



Re: [PHP] making a tutorial

2006-03-16 Thread admin
Parse.. It will be an array after you submit the form.
So depends on what you wanna do with it.

Do a print_r($favourite); after form submit and you will see.

How to  store it.. well if you wanna it in seperate fields you can loop
through it and do an insert on every array element in your DB or store it
serialized. Or create a string from the array and store it in a DB field.
enum? Don't think it will work :)

grtz,
Thijs

 I'm making a tutorial and don't really understand how to do this myself :)

 pWhich of the following pets do have at home:
 br /input type=checkbox name=favourite[] value=dogdog
 br /input type=checkbox name=favourite[] value=catcat
 br /input type=checkbox name=favourite[] value=snakesnake
 br /input type=checkbox name=favourite[] value=othersnake
 br /input type=checkbox name=favourite[] value=nonenone of these
 /p

 How do I parse favourite[]? I might have 2 or 5, so I need to parse ^0]
 - nMax. It is a checkbox.

 I might use favourite[] with mail() or store it in a mysql field.

 If mysql, would I store it in a varchar(20) or an enum() and how?

 John



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] making a tutorial

2006-03-16 Thread - Edwin -
Hi!

On Fri, 17 Mar 2006 01:51:41 -0500
John Taylor-Johnston wrote:

 I'm making a tutorial and don't really understand how to do
 this myself :)
 
 pWhich of the following pets do have at home:
 br /input type=checkbox name=favourite[]
 value=dogdog 
 br /input type=checkbox name=favourite[]
 value=catcat 
 br /input type=checkbox name=favourite[]
 value=snakesnake 
 br /input type=checkbox name=favourite[]
 value=othersnake 
 br /input type=checkbox name=favourite[]
 value=nonenone of these 
 /p

While you're at it, why not use input ... / instead?
(Pls. notice the last forward slash.)

 How do I parse favourite[]? I might have 2 or 5, so I need to
 parse ^0] 
 - nMax. It is a checkbox.

Not exactly sure what you meant but check what's
submitted with:

  $_POST['favourite'] or $_GET['favourite']

 I might use favourite[] with mail() or store it in a mysql
 field.
 
 If mysql, would I store it in a varchar(20) or an enum() and
 how?

It all depends on how your tables are setup but I don't know
about enum()...

 John

HTH,

- Edwin -

-- 
Keep doing this in remembrance of me. - Luke 22:19

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] making a tutorial

2006-03-16 Thread Gustav Wiberg


- Original Message - 
From: John Taylor-Johnston [EMAIL PROTECTED]

To: PHP-General php-general@lists.php.net
Sent: Friday, March 17, 2006 7:51 AM
Subject: [PHP] making a tutorial



I'm making a tutorial and don't really understand how to do this myself :)

pWhich of the following pets do have at home:
br /input type=checkbox name=favourite[] value=dogdog
br /input type=checkbox name=favourite[] value=catcat
br /input type=checkbox name=favourite[] value=snakesnake
br /input type=checkbox name=favourite[] value=othersnake
br /input type=checkbox name=favourite[] value=nonenone of these
/p

How do I parse favourite[]? I might have 2 or 5, so I need to parse ^0]
- nMax. It is a checkbox.

I might use favourite[] with mail() or store it in a mysql field.

If mysql, would I store it in a varchar(20) or an enum() and how?

John



Hi there!

Do you have to name it as favourite[]? Can't you name it as just favourite 
(without brackets)
If you name it as just favourite, at least in Javascript you could loop 
through favourite as an array. I don't know if this works in PHP as well.


Best regards
/Gustav Wiberg

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php