Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old January 26th, 2006, 02:25 AM
Ren
Guest
 
Posts: n/a
Default How do you insert a value from drop down list to SQL table?

Hi all,

I am a bit new to PHP and SQL so this may seem like a dumb question.

I have already created a drop down list as part of a form which is
automatically populated with values taken from a separate database. When a
user goes onto this page and either leaves the default value or selects a
value from the drop down list and presses the submit button, I would like
that selected value to be stored into a database which I have already
created in SQL.

Just to let you know that I can do the above using a text field but just
don't know how to do it with drop down list.

If your going to explain any coding then it may help if I give you the names
of certain items that are involved.

Database is called "Company"
Field within database is called "Name"

Drop down list is called "company"

Thanks
Ren


  #2  
Old January 26th, 2006, 02:25 AM
Juliette
Guest
 
Posts: n/a
Default Re: How do you insert a value from drop down list to SQL table?

Ren wrote:[color=blue]
> Hi all,
>
> I am a bit new to PHP and SQL so this may seem like a dumb question.
>
> I have already created a drop down list as part of a form which is
> automatically populated with values taken from a separate database. When a
> user goes onto this page and either leaves the default value or selects a
> value from the drop down list and presses the submit button, I would like
> that selected value to be stored into a database which I have already
> created in SQL.
>
> Just to let you know that I can do the above using a text field but just
> don't know how to do it with drop down list.
>
> If your going to explain any coding then it may help if I give you the names
> of certain items that are involved.
>
> Database is called "Company"
> Field within database is called "Name"
>
> Drop down list is called "company"
>
> Thanks
> Ren
>
>[/color]

Ren,

Submit your form to a simple testpage which contains the following:

print_r($_POST);

or - depending on your php version -

print_r($HTTP_POST_VARS);


You should now see exactly what is being submitted by your form (and
how) which should tell you how you can reference the value you want to
put into your database.

Grz,
Juliette
  #3  
Old January 26th, 2006, 03:05 AM
Ren
Guest
 
Posts: n/a
Default Re: How do you insert a value from drop down list to SQL table?

Thanks Juliette for the reply.

Just to let you know that I made a stupid typing error in the php code that
is why it was not working.

Sorry about that!
Ren


"Juliette" <jrf_no_spam@jokeaday.net> wrote in message
news:43d83164$0$47842$dbd43001@news.wanadoo.nl...[color=blue]
> Ren wrote:[color=green]
>> Hi all,
>>
>> I am a bit new to PHP and SQL so this may seem like a dumb question.
>>
>> I have already created a drop down list as part of a form which is
>> automatically populated with values taken from a separate database. When
>> a user goes onto this page and either leaves the default value or selects
>> a value from the drop down list and presses the submit button, I would
>> like that selected value to be stored into a database which I have
>> already created in SQL.
>>
>> Just to let you know that I can do the above using a text field but just
>> don't know how to do it with drop down list.
>>
>> If your going to explain any coding then it may help if I give you the
>> names of certain items that are involved.
>>
>> Database is called "Company"
>> Field within database is called "Name"
>>
>> Drop down list is called "company"
>>
>> Thanks
>> Ren
>>
>>[/color]
>
> Ren,
>
> Submit your form to a simple testpage which contains the following:
>
> print_r($_POST);
>
> or - depending on your php version -
>
> print_r($HTTP_POST_VARS);
>
>
> You should now see exactly what is being submitted by your form (and how)
> which should tell you how you can reference the value you want to put into
> your database.
>
> Grz,
> Juliette[/color]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles