473,781 Members | 2,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mysql column populating drop down menu issue

38 New Member
Hi there,

I've essentially got a form with several drop down, each populated by columns in various tables.

The populating bit works fine - the column rows appear as they should in the menu.

Ideally the user needs to make their selections, and enter the form into a new database table.

The problem is, when the selection is entered into the new table, only the first word of the string is entered. For example, the drop down may have...

"Category One"
"Category Two"
"Category Three"

When the form is submitted only the word "Category" is entered into the database.

Here is the code, it takes the column 'courseTitle' from one table, displays it in a menu, and then saves the selection into a new table as 'eventName'.

Expand|Select|Wrap|Line Numbers
  1. <?
  2. include("connect.php"); 
  3. $query="SELECT courseTitle FROM course";
  4. $result = mysql_query ($query);
  5. echo "<select name='eventName'=''></option>";
  6. while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
  7. echo "<option value=$nt[courseTitle]>$nt[courseTitle]</option>";
  8. }
  9. echo "</select>";// Closing of list box 
  10. ?>
  11.  

Apologies if I've made it slightly long winded.
Aug 4 '09
14 4341
Markus
6,050 Recognized Expert Expert
@Dormilich
Yeah, what Dorm said. ;)
Aug 5 '09 #11
Philth
38 New Member
Yeah, sorry for being dim today.

Thanks for everyones help.
Aug 5 '09 #12
Dormilich
8,658 Recognized Expert Moderator Expert
and while we're quoting........ . you should always quote the array's keys (unless they're variables or indeed constants (which is btw rather rare))
Aug 5 '09 #13
dlite922
1,584 Recognized Expert Top Contributor
@Philth
Me too, I knew it has something to do with the values not posting correctly, thus form issue.

I always quote my html attributes. It's best to always ensure they're valid also:

http://validator.w3.org/

preferably with XHTML 1.0

Cheers,



Dan
Aug 5 '09 #14
Dormilich
8,658 Recognized Expert Moderator Expert
@dlite922
sadly, there is no XHTML support in IE.......
Aug 5 '09 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3902
by: Jason | last post by:
I have a client that would like to have drop down menus added to a nav bar that is generated from MySQL. Is it possible to have a dynamically driven DHTML menu from MySQL? example link http://www.msnbc.msn.com/Default.aspx?p1=0
4
2643
by: Mike Wilcox | last post by:
I use the following code snippet to build a drop down menu with the results of a query. How can I set the initial value of this input based on the result of another query? What I am trying to do is update records in the data base. The field WkEndDate is pulled along with the rest of the record and the drop down menu is built from a table of valid WkEndDate values. echo ("Weekend Date: <select name='WkEndDate'/> ");
0
3948
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest version of this document can be found at: http://prdownloads.sourceforge.net/souptonuts/README_mysql.txt?download
9
1880
by: elyob | last post by:
Hi, I'm looking at storing snippets of details in MySQL about what credit cards a business excepts. Rather than have a whole column for Visa, another for Amex etc ... I am looking at having a column called payment types and inserting multiple codes ... e.g. ViAmBcCa Is this a good way of doing things? To me it'd be a lot cleaner and limit amount of Db work to be done. Is this a sensible way in your opinion? What's the best way of...
3
4958
by: Angelos | last post by:
Hello again, I have this dynamic menu and I want to change the order of the menu items... I added a column in the database wich has an integer value for ordering the menuitems. But the only way is by hardcoding them into the database. I would like a way to sort them with drag-and-drop or with up/down arrows. Do you think that except PHP & MYsql I will need Javascript as well ?
0
7360
by: tusaar | last post by:
Hi all I am in big need for a drop down menu created with php, mysql and ajax. Exactly, I need three drop down menu (Category, Subcategory and Item). The data of each drop down will come from Mysql. Anybody can help me please.. I will be very much thankfull. Please help me and give me a proper solution for that ASAP. Thanks Tushar
2
5257
by: Boujii | last post by:
Greetings, I have been attempting to make a drop down menu of countries. From this menu I wish to create a variable in order to INPUT into mysql database. I have no trouble making the drop down menu, but I am unable to store a variable for it. Here is a rough copy of what I am making: <html> <head> <title>Add New MySQL User</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
7
2506
by: dongletran06 | last post by:
Hi, Please help me find out what wrong with my codes in inputting from my form to mysql database using drop down menu. Below is the codes I used. Only the drop down is not working but the "input text" are successfully adding data to mysql. I just try first using the month as drop down. The month data type I used in mysql database is varchar. Im new in PHP please help me. Thanks <?php /* Created on: 10/12/2006 */ ?> <html> <body> <?php...
6
38520
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get through this without much trouble. Programming knowledge is not required. Index What is SQL? Why MySQL? Installing MySQL. Using the MySQL command line interface
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10143
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7486
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.