AJAX & PHP Help

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Aug 2004
Posts: 12
Reputation: msimonds is an unknown quantity at this point 
Solved Threads: 0
msimonds msimonds is offline Offline
Newbie Poster

AJAX & PHP Help

 
0
  #1
Oct 24th, 2008
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['id'] 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
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <?php
  2. echo '<pre>' . print_r($_GET, true) . '</pre>';
  3. ?>
  4. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
  5.  
  6. <html>
  7. <head>
  8. <title></title>
  9. <style type="text/css">
  10. /* ---------------------------- */
  11. /* CUSTOMIZE AUTOSUGGEST STYLE */
  12. #search-wrap input{width:400px; font-size:16px; color:#999999; padding:6px; border:solid 1px #999999;}
  13. #results{width:260px; border:solid 1px #DEDEDE; display:none;}
  14. #results ul, #results li{padding:0; margin:0; border:0; list-style:none;}
  15. #results li {border-top:solid 1px #DEDEDE;}
  16. #results li a{display:block; padding:4px; text-decoration:none; color:#000000; font-weight:bold;}
  17. #results li a small{display:block; text-decoration:none; color:#999999; font-weight:normal;}
  18. #results li a:hover{background:#FFFFCC;}
  19. #results ul {padding:6px;}
  20. </style>
  21. </head>
  22.  
  23. <body>
  24. <h4>Your current Product for this opportunity is <?php echo $_GET['name']; ?></h4><!-- AJAX AUTOSUGGEST SCRIPT -->
  25. <script type="text/javascript" src="lib/ajax_framework.js">
  26. </script>
  27.  
  28. <div id="search-wrap">
  29. <h2>Search for new product</h2><input name="search-q" id="search-q" type="text" onkeyup="javascript:autosuggest()">
  30.  
  31. <div id="results"></div>
  32. </div><script type="text/javascript">
  33. function setpartno(partno) {
  34. document.getElementById('search-q').value = partno;
  35. var e = document.getElementById('results');
  36. e.innerHTML='<input type=submit value="Change Part Number">';
  37. //e.style.display="none";
  38. }
  39. function updatePartName(){
  40. nocache = Math.random();
  41. http.open('get', 'lib/update.php?id='+q+'&partname = '+nocache);
  42. }
  43. </script>
  44. </body>
  45. </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['id'] 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
Last edited by peter_budo; Oct 27th, 2008 at 3:32 am. Reason: URL SNIPPED - user request
Attached Thumbnails
screenshot1.jpg  
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum


Views: 853 | Replies: 0
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC