Hi All,
I am using this code to populate a drop down list from mysql database.
I need to pass id and name through this code.but the problem is the value is lost when the page gets refreshed.and it works fine if i pass only name through it.
my code is as follows:
ok.more precisely, i am using this form in such a way that,when client name is selected, it will submit the form and will show the quotation numbers related to that client.but when the value is submitted,it shows the quotations, but dosent show the client name.is there any solution for this??
Yes there is. To get to the solution, more needs to be known about the problem.
What is the bad HTML code. You can see the rendered HTML code by right-clicking on the page and selecting “View page source”, or something equivalent.
I suspect that the problem is that you are placing the name as an attribute of the html element instead of as the content part of the element itself, but the only way to find out for sure is to confirm that suspicion against the actual HTML code itself.
By knowing what’s going bad, we can adjust the PHP script so that it created good code. Anything else and we’re just making blind stabs in the dark.
Yes it is not showing any value in “selected” attribute in page source.probably because client_id is not posted.
please have a look at the example:http://believecreation.org/test/test.php.
when values are selected from both of the drop downs,the values are lost.:(:(
The form posts the value that’s in the value attribute, which in this case is 1 or 2.
The comparison you make in your PHP file is currently checking the name, instead of the id.
I have stored the client_ids in the table.so i cant just pass the name.
“check the id number against the posted number” sounds cool.but seriously dont know how i can achieve this.if i use
If you don’t want to change anything about the form values, or the way the form values are interpreted, then you need an in-between step where you use the POSTed number to retrieve the name from the database.
You can use that POSTed name id to create a new result row that that has 1 where the name matches the id, or 0 where it doesn’t.
o yeh.its just 4.10 pm here.so i am in my full swing.i will keep trying some solution for this.n hope SQL gurus will help me out as always good nyt n sweet dreams n yeh thx again