cleary1981 Posted July 1, 2008 Share Posted July 1, 2008 I keep getting a result returned of undefined when I query my database. Can anyone please help. When I run my php irectly in the browser it works fine. Heres my code <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title>TES - Pricing System</title> <link rel="stylesheet" type="text/css" href="style.css" /> </script> <script type="text/javascript" src="prototype.js"></script> <script type="text/javascript" src="scriptaculous.js"></script> <script language="javascript" src="list.php"></script> <script type="text/javascript" src="getdimensions.js"> </script> <script type="text/javascript" src="text-utils.js"> </script> <script type="text/javascript"> var request = null; try { request = new XMLHttpRequest(); } catch (trymicrosoft) { try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { request = null; } } } if (request == null) alert("Error creating XMLHttp Request!"); window.onload = function() { new Draggable('object', {snap:25} ); fillCategory(); } function get_description() { var model = document.getElementById("model").value; var url = "lookupdescription.php?model=" + escape(model); request.open("GET", url, true); request.onreadystatechange = updatePage; request.send(null); } function updatePage() { if (request.readyState ==4) { var modeldescription = request.reponseText; var x = document.getElementById("description"); replaceText(x, modeldescription); } } </script> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000"> <div id="container"> <div id="top"> <h1>TES - Pricing System (Design Mode)</h1> </div> <div id="leftSide"> <fieldset> <legend>Module</legend> <FORM name="drop_list"> <label for="type">Type</label> <div class="div_texbox"> <SELECT NAME="Category" onChange="SelectSubCat();" > <Option value="">Select Type</option> </SELECT> </div> <label for="mod_named">Model</label> <div class="div_texbox"> <SELECT id="model" NAME="SubCat" onChange="get_description();"> <Option value="">Select Model</option> </SELECT> </div> <fieldset> <legend>Description</legend> <span id="description">description goes here</span> </fieldset> <label for="mod_name">Name</label> <div class="div_texbox"> <input name="username" type="text" class="username" id="username" value="" /> </div> <div class="button_div"> <input name="Submit" type="button" value="Generate" class="buttons" onClick="generate_module()"/> </div> </form> </fieldset> <fieldset> <fieldset> <legend>Delete</legend> </fieldset> <fieldset> <legend>Generated Module</legend> <img id="object"> </fiedset> </fieldset> </div> <div id="content"> <div id="drop_area"> </div> </div> <div class="clear"></div> </div> </body> </html> and heres the php <?php require "config.php"; $model = $_REQUEST['model']); $sql = "SELECT mod_desc FROM module WHERE module_name='$model'"; $result = mysql_query($sql) or trigger_error(mysql_error()); $row = mysql_fetch_object($result); $description=$row->mod_desc; //this has to match what you have in the select statement. echo $description; ?> I'm pretty sure the php is fine because i've had alot of great help with it. Any ideas guys? Link to comment https://forums.phpfreaks.com/topic/112747-solved-undefined-whats-is-wrong-here/ Share on other sites More sharing options...
cleary1981 Posted July 1, 2008 Author Share Posted July 1, 2008 Solved it myself :D I left an s out of responseText (idiot) lol Link to comment https://forums.phpfreaks.com/topic/112747-solved-undefined-whats-is-wrong-here/#findComment-579065 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.