473,383 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Selects coming across

The1corrupted
134 100+
This is currently befuddling me and it's a little bit of html/php but the thing that isn't working is the php...

Basically, my issue is that my <select> doesn't create a text value to be input into a mysql table like so...

Page 1
Expand|Select|Wrap|Line Numbers
  1. <select name='name'>
  2. <option value='Yay'>yay</option>
  3. </select>
and I'm trying to input it into a mysql table...
[PHP]
<?php
$nam=$_POST['name'];
mysql_query("INSERT INTO `user_table`(`name`) VALUES ('$nam');
?>[/PHP]

The field Name is set as a text type, and I am confused as to what is wrong.
Mar 5 '07 #1
1 920
ronverdonk
4,258 Expert 4TB
To start, your query is incorrectly specified, like not closing the string
Expand|Select|Wrap|Line Numbers
  1. mysql_query("INSERT INTO `user_table`(`name`) VALUES ('$nam');
  2.  
should be
Expand|Select|Wrap|Line Numbers
  1. mysql_query("INSERT INTO `user_table`(`name`) VALUES ('$nam')");
Otherwise it means that you have another error, because at first sight the code looks ok, but I am missing the other code around your select box.

So show all code involved, including the form definition and the start of your php code to catpure the POSTed variables.

Ronald :cool:
Mar 5 '07 #2

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

Similar topics

1
by: Marc | last post by:
Hello, I have a form with multiple selects (pullDown). All selects have the same name but each select has a different value. The user selects a value in each select. When he submits the form I...
7
by: Nick Calladine | last post by:
Hi On my form i have multiple select which all have an id value total1, total2, total3 etc so i am trying to detect how many there are and then use this to caculate a total. Is there a...
2
by: Leszek Taratuta | last post by:
Hello, I am using the following code to prevent users to see the previous pages: Response.CacheControl = "no-cache"; Response.AddHeader( "Pragma", "no-cache" ); Response.Expires = -1; When...
45
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
5
by: Daniel | last post by:
Using serialisation can anyone tell me how i can use it to work out what object was serialised? For example i have a class Ball and another class Bat. i serialise the first class Ball and send...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
1
by: Riley | last post by:
DB2 v8 for z/OS Data for each employee is spread across 12 tables. We are accessing 12 tables with each table having from zero to one row per employee, except the first table has a required row...
0
by: Ronald S. Cook | last post by:
When I pass a null date from my client to my service project, it comes across as #12:00:00 AM#. While I can easily code for this, it seems like a hack. Is this normal? I'm using WCF, by the...
2
by: bikefixxer | last post by:
Alright, I've been trying to figure this out for over an hour now and have been searching all over google but can't find anything, so I'm hoping someone here can help me out. First, a description of...
6
by: Pascal Ehlert | last post by:
Hi group! I was trying to build a JS solution for related select lists (child lists gets populated depending on the value selected in parent list), which uses no Ajax and is still "usable" in an...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.