RE: Radio buttons problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: leledumbo [mailto:leledumbo_cool@xxxxxxxxxxx]
> Sent: 07 August 2009 05:43
> 
> > This should work:
> >
> > <input type='radio' name='sex[1]' value='1'>
> > <input type='radio' name='sex[1]' value='2'>
> > <input type='radio' name='sex[2]' value='1'>
> > <input type='radio' name='sex[2]' value='2'>
> 
> Yes, that works. But should I manually maintain the number in the
> bracket?
> Is there anyway so that it can be automatically maintained? Because
> my app
> allows to delete entries arbitrarily. For instance, consider this
> layout (+
> is insert button, - is delete):
> 
> entry1 +/-
> entry2 +/-
> entry3 +/-
> 
> entry1 has sex[0] field, entry2 has sex[1] and so on. If entry2 is
> deleted,
> then I have to change all sex fields in entries below entry2 which
> is a
> waste of time.

Why do you? There's no reason you *have* to have consecutive indexes -- just iterate over the resulting array with foreach, and there's no problem. (Unless your back-end logic demands sequential id numbers, but my opinion would be there's something wrong with your design if it does.)


Cheers!

Mike
 -- 
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,  
Leeds Metropolitan University, C507, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom 
Email: m.ford@xxxxxxxxxxxxxx 
Tel: +44 113 812 4730





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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux