Transfering html Form Option values to mysql INSERT function

Posted on 2009-02-19
Last Modified: 2013-12-12
I'm trying to pass values from an html option value to php variable then to
This may be a simple task but at the moment can not see where I'm going wrong.  The other variables are inserted OK just id is not.
Question by:richmatt
    LVL 16

    Expert Comment

    please post your code for analysis
    LVL 12

    Accepted Solution

    Try this test form...perhaps this will answer your question for you.

    Hope this helped. :)

    		print "<pre>";
    		print "</pre>";
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <form name="test" method="post" action="<?=$_SERVER['PHP_SELF']?>">
    <input type="radio" name="myOpts[]" value="1" /> Option 1<br />
    <input type="radio" name="myOpts[]" value="2" /> Option 2<br />
    <input type="radio" name="myOpts[]" value="3" /> Option 3<br />
    <select name="selOpts[]">
     <option value="sel1">Select 1</option>
     <option value="sel2">Select 2</option>
     <option value="sel3">Select 3</option>
    </select><br />
    <input type="submit" name="submit" value="Submit" />

    Open in new window


    Author Closing Comment

    The solution was obtained from the sample test form ie where name = should go and what name that should be.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
    Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now