Jump to content

[SOLVED] insert values thru drop down box


Recommended Posts

Hey guys not sure where to post this, but here it is anyway, ive got a drop down box for select, what I need to do is, I need it to select 2 values at the same time on select so it inserts both to the db at the same time, if you get what i mean, example below.....

 

original code

 

<input name="sicker" type="text" id="sicker" value="{me.sicker}" size="10" maxlength="3" />

 

<select name="sick" id="sick">

<option value="{me.sick}">-{me.sick}-</option>

<option value="">(none)</option>

<option value="fine">fine</option>

<option value="ill">ill</option>

 

the top code you type in your text like 8 and adds a gif next to your text select

 

what i need is how i go about adding values so if they select {me.sick} then it selects {me.sicker} to add the gif next to it as it inserts both entrys in to the db at the same time, it works fine now, but id rather users select just 1 instead of opening another page to view the gifs to get the code to add in the text box.

 

hope i make sense

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/120024-solved-insert-values-thru-drop-down-box/
Share on other sites

ok will try and explain a bit better, this code <input name="sicker" type="text" id="sicker" value="{me.sicker}" size="10" maxlength="3" /> is text so if u type in 7 it will add a gif beside the select option here <select name="sick" id="sick">

<option value="{me.sick}">-{me.sick}-</option>

<option value="">(none)</option>

<option value="fine">fine</option>

<option value="ill">ill</option>

 

when u hit submit it inserts both entries into the db at the same time, what i need for the user to select the option example: <option value="fine">fine</option> if i was to do the same with {me.ill} it would look like this

<select name="ill" id="ill">

<option value="{me.ill}">-{me.ill}-</option>

<option value="">(none)</option>

<option value="1">1</option>

<option value="2">2</option>

 

to put it in plain engliah i hope, can it be done with 2 values in the one select, ive read where it can be, but have not seen a example

 

 

 

 

 

 

 

I still don't really get what you are saying.

 

It sounds like you want to use some javascript to set the content of one input depending on what is inserted into the other input. Is that correct? If so, you will need to use javascript to listen for an entry into the input box, then use the DOM to change the visible value in the drop down box.

heres the code, 1 you type in text the other you select then u hit submit and it gets inserted into the db, can it be done where if i add in the text instead of the user and then they just select 1 option it inserts both in as well, if you look at the code you will see where ones select and other is text, as you can see its 2 values now but user has to type in the text value in 1st box to choose icon to go along with the set option, u cant see image code as the icon values are just numbers they type

 

<input name="ill" type="text" id="ill" value="{me.ill}" size="10" maxlength="3" />

<br>

<select name="sick" id="sick">

        <option value="{me.sick}">-{me.sick}-</option>

        <option value="">(none)</option>

        <option value="sick">sick</option>

        <option value="ill">ill</option>

  <option value="not well">not well</option>

 

  </td>

              </tr>

 

              <tr>

                <td></td>

                <td><input type="submit" name="submitUserData" value="[submit {295}]" class="submit" /></td>

lol no, the code i posted above works fine, let me try again here, if u understand values, that code above inserts fine into 2 separate db tables on submit, now let me set it str how it works, 1 is text in which the user types in a number to set the gif that goes beside the select option, its a pain as the user has to open another page to view the gif page to see what number they need for what gif, now again, instead of the user typing in the text area the number, i want it to select like the option value, i can make it select thats easy, but to select 2 values at the same time is what i need, so when a user selects say 1 it also selects 1a at the same time, sorry but i cant make it any clearer then that, like I said a few times, select 2 values at the same time..

 

 

thanks

the user types in a number to set the gif that goes beside the select option

 

What do you mean 'go beside the select option'?

 

i want it to select like the option value,

 

You want what do select the option value?

 

to select 2 values at the same time is what i need

 

Select two values from the drop down list?

 

so when a user selects say 1 it also selects 1a at the same time

 

Selects 1a from where?

 

sorry but i cant make it any clearer then that

 

Try multiple sentences, correct terminology and less use of pronouns, and it may be a little easier for us to understand. As you have it now, it's very unclear.

 

Or if you have a link to an example page, maybe we can look at that.

Or if you have a link to an example page, maybe we can look at that.

 

Try putting it like this;

 

-User will click X and should get Y

-User will then click B and get C

-This is then added to two separate tables in my database, however I want it to add Y and C into the same database.

 

Good luck  :)

I seriously dont see how you 2 dont get want im tyring to achieve and then you both quote and say paste a link so u can see, well i pasted the whole code in on a previus post..

 

 

<input name="ill" type="text" id="ill" value="{me.ill}" size="10" maxlength="3" />

 

 

<select name="sick" id="sick">

                                <option value="{me.sick}">-{me.sick}-</option>

                                <option value="">(none)</option>

                                <option value="sick">sick</option>

                                <option value="ill">ill</option>

                              <option value="not well">not well</option>

                             

                              </td>

              </tr>

 

              <tr>

                <td></td>

                <td><input type="submit" name="submitUserData" value="[submit {295}]" class="submit" /></td>

 

all you have to do is paste that in a editor and view it, u will see how it works now. ive explained in a few diff ways and to be quite honest i think simple terms, the below was an example and you say where? good grief.

 

 

Quote

so when a user selects say 1 it also selects 1a at the same time

 

Selects 1a from where?

 

 

im not trying to be difficult here, but maybe you guys should read into it a tad better, if you see the code i pasted that works now, one is text one is select, now if you know myspace you will see what im trying to do here 1 my code a user has to type in the text box in order to choose the gif, then they select the option and when u hit submit hey presto it works, so if u take note of myspace mood where the user just picks a text option the gif gets assigned to the mood saying, where mine user has type in a number in order to assign the gif to the option selected, so in a nut shell, i want if a user selects a drop down option the gif number gets selected at the same time.

 

sorry if i come across harsh, but this is doing my head in

 

 

Regards

You are asking a question and posting code. Obviously your code doesn't work, or you wouldn't need to ask the question.

 

Did you even look at my last post? I pointed out why it is so difficult to understand what you are saying, but you didn't bother to clarify any of the points I asked about.

 

Your writing is unclear, and filled with unclear pronouns that aren't clearly pointed at any subject, making it difficult to understand what you are talking about.

 

I come here every day and help people for free. Some of those people are speaking English as a second language, and they are more clear than you (hint - English uses a thing called 'sentences'. As in plural. They end with periods, and break up ideas making easier for the reader to understand). If you can't explain your problem well enough for those reading to be able to understand, then you have no right to complain when they aren't able to help you. The onus is on you to succinctly explain yourself. As it stands now you have posted a bunch of gibberish.

 

Now if you want help, go back and look at my last post, and answer the questions there, and maybe it will give us a clearer idea of what exactly it is that you want. And type in somewhat proper English, its a standard that allows everyone to know what you are talking about. If you speak in your own personal little lingo, the rest of us don't know that.

 

Now quit complaining about *free* help. None of us is getting paid to help you.

whos complaining, and maybe you should go and learn how to read english, im over it here and i hope the administrators read this post, ive been coming here for a longtime now and to be insulted by a friggin moron, blah, im closing this post as solved as you just solved it  ;D

whos complaining, and maybe you should go and learn how to read english, im over it here and i hope the administrators read this post, ive been coming here for a longtime now and to be insulted by a friggin moron, blah, im closing this post as solved as you just solved it

 

Heh, the irony kills me. Maybe I should learn how to *read* English? Let's at that 'sentence' of yours.

 

1) Who's should be capitalized.

2) Who's should have an apostrophe.

3) Who's complaining should end with a question mark, as it appears to be a question

4) Improper usage of the word 'and'. You aren't modifying the word 'who's'.

5) The sentence beginning with 'and' should be a new sentence, as it is expressing a different idea than the first sentence.

6) The word 'English' should be capitalized.

7) 'I' should be capitalized in 'I've'.

8) 'I've' should have an apostrophe.

9) The part that starts with 'I've' should be a separate sentence.

 

That's just off the top of my head. You complain about me not being able to read English? I'll tell you what. After you are finished puberty, if you are able to actually write English, I'll be happy to read what you have to say. But to call me a 'friggin moron', because you can't even write English well enough for others to read, and you can't answer a few simple questions asking you the specifics of your problem, well that's just laughable.

 

I think you made my day. Have fun with your problem. Feel free to whine about it some more, and if you do it in a comprehensible manner, I may even answer your question for you.

 

I'm happy to take credit for solving your problem though! Thanks!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.