msimonds 0 Newbie Poster

Was wondering if you could take a look at the attached code.

I have a form that is making a call back to the database and populating search form for parts. As you type in parts, it renders choices (screenshot2 attached). You can then click on a choice and it populates the text box and a button also renders.

You can actually test the script: <URL SNIPPED>

Start typing in "DS12" and then click on one, you will see what I mean (screenshot1 attached).

What I want to do is take the $_GET and the new part number in the form to another script, right now just putting it into an array. I have a javascript function that sets up the form, called setpartno:


product_search.php

<?php
echo '<pre>' . print_r($_GET, true) . '</pre>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

<html>
<head>
    <title></title>
    <style type="text/css">
    /* ---------------------------- */
    /* CUSTOMIZE AUTOSUGGEST STYLE  */
    #search-wrap input{width:400px; font-size:16px; color:#999999; padding:6px; border:solid 1px #999999;}
    #results{width:260px; border:solid 1px #DEDEDE; display:none;}
    #results ul, #results li{padding:0; margin:0; border:0; list-style:none;}
    #results li {border-top:solid 1px #DEDEDE;}
    #results li a{display:block; padding:4px; text-decoration:none; color:#000000; font-weight:bold;}
    #results li a small{display:block; text-decoration:none; color:#999999; font-weight:normal;}
    #results li a:hover{background:#FFFFCC;}
    #results ul {padding:6px;}
    </style>
</head>

<body>
    <h4>Your current Product for this opportunity is <?php echo $_GET['name']; ?></h4><!-- AJAX AUTOSUGGEST SCRIPT -->
    <script type="text/javascript" src="lib/ajax_framework.js">
    </script>

    <div id="search-wrap">
        <h2>Search for new product</h2><input name="search-q" id="search-q" type="text" onkeyup="javascript:autosuggest()"> 

        <div id="results"></div>
    </div><script type="text/javascript">
    function setpartno(partno) {
    document.getElementById('search-q').value = partno;
    var e = document.getElementById('results');
    e.innerHTML='<input type=submit value="Change Part Number">';
    //e.style.display="none";
    }
    function updatePartName(){
    nocache = Math.random();
    http.open('get', 'lib/update.php?id='+q+'&partname = '+nocache);    
    }
    </script>
</body>
</html>

I want to pass that Id and part number, as I stated above, to updatePartName(), you will see that below setpartno.

I do not know what to do with this part, I am a little lost. I was wondering if anyone could take a look at it. So I want to click on the button and pass that info ($_GET and partno (that has been selected) to the update.php script.

I do not know how to pass that in the updatePartName and I also do not know what code I need to do to submit the button, if any or is that code okay?


Man I hope this jibbersh makes sense

Thanks in Advance
~Mike