OZONE Asylum
Forums
Server-Side Scripting - Oh my!
outlining a website help please
This page's ID:
29290
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Suho : yeah I found what I was looking for. I do need some assistance though. Making progress but ran into a snag. Here is the index page with the Ajax stuff: [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Dynamic Image</title> <meta name="generator" content="MAX's HTML Beauty++ 2004" /> <script type="text/javascript"> // Set path to PHP script var phpscript = 'output.php'; function createRequestObject() { var req; if(window.XMLHttpRequest){ // Firefox, Safari, Opera... req = new XMLHttpRequest(); } else if(window.ActiveXObject) { // Internet Explorer 5+ req = new ActiveXObject("Microsoft.XMLHTTP"); } else { // There is an error creating the object, // just as an old browser is being used. alert('Problem creating the XMLHttpRequest object'); } return req; } // Make the XMLHttpRequest object var http = createRequestObject(); function sendRequestGet(userName) { // Open PHP script for requests http.open('get', phpscript+'?userName='+userName); http.onreadystatechange = handleResponseGet; http.send(null); } function handleResponseGet() { if(http.readyState == 4 && http.status == 200){ // Text returned from PHP script var response = http.responseText; if(response) { // Update ajaxTest content document.getElementById("uImage").innerHTML = response; } } } </script> </head> <body> <table> <tr> <td>Username:</td><td><input type="text" id="userName" name="userName" /></td> <tr> <tr> <td> <input type="button" value="Submit" onclick="sendRequestGet(<?echo $_GET['userName'];?>);" /> </td> </tr> </table> <div id="uImage"> <img src="bcardtemplate.php" /> </div> </body> </html> [/code] The output.php page that is called in the Ajax above : [code] <? if(isset($_GET['userName'])) { echo "<img src=\"bcardtemplate.php?userName=" . $_GET['userName'] . "/>"; } ?> [/code] real slick right there :p It is creating the image just fine. When something is entered into the text field, it writes to it but instead of giving the text from the input box, it always says "undefined". When I see this in PHP I usually am screwing something up with an array. What is this doing? Thanks in advance! Later, C:\ [small](Edited by [url=http://www.ozoneasylum.com/user/1079]CPrompt[/url] on 07-03-2007 20:00)[/small] [small](Edited by [url=http://www.ozoneasylum.com/user/1079]CPrompt[/url] on 07-03-2007 20:02)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »
Maximum Security
OZONE
DHTML/Javascript
Server-Side Scripting - Oh my!
CSS - DOM - XHTML - XML - XSL - XSLT
Stupid Basic HTML
Visual Therapy
Photoshop
Photoshop Pong, Anyone?
***WARNING*** BIG SIG APPROACHING
Photography
3D Modelling & Rendering
Multimedia/Animation
Print Graphics
Holding Pens
Philosophy and other Silliness
Outpatient Counseling
Site reviews!
Mad Scientists' Laboratory
Getting to know the Grail