NYCPHP Meetup

NYPHP.org

[nycphp-talk] MySQL and spaces in data

Analysis & Solutions danielc at analysisandsolutions.com
Thu Jun 19 19:02:10 EDT 2003


Jeff:

On Thu, Jun 19, 2003 at 05:36:16PM -0400, Jeff wrote:
> Dan,
> 
> Thanks for your input...here's some more info on what I'm doing.
>
> <input name="ALFA-ROMEO|GTV-6" type="checkbox" value="1" checked >
> <input name="ALFA-ROMEO|SPIDER VELOCE" type="checkbox" value="1">
> 
> First part gives me the manufacturer, second part gives me the model.

But what you haven't clarified is the forms actual purpose.  Okay, so,
you're processing the manufacturer and model in the checkboxes.  But what
does it mean if someone checks the box?  In addition, what other data is
submitted?  What are you doing with all of this data?

Before writing what I just wrote, I started writing the following, so I'm 
leaving it here to avoid having to restate it later...

You mentioned using a database.  I assume each manufacturer and each model
are represented by integer based primary keys.  Right?  Again, if you want
to store both the manufacturer and model ID numbers in the name attribute
of the name element, do this:

   <input name="cars[5][23]" ... />
   <input name="cars[5][50]" ... />
   <input name="cars[10][2]" ... />

Where the first key is the manufacturer and the second key is the model.


> The post data has underscores.

Which is why I'm saying you should use use a different approach.

--Dan

-- 
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409



More information about the talk mailing list