View Full Version : Resolved Problem with <body onLoad>
07-20-2009, 12:54 AM
The following script works when I load the page. However, I have a form that, when submitted, doesn't run the script again. I have a page called restaurants.php. Submitting the form goes to restaurants.php?a=edit. This second loading of restaurants.php doesn't re-call the 'createAutoComplete' function again. Instead, it shows the output from its first calling. Any ideas? Here is some code...
<body onLoad='createAutoComplete(<?php echo $restString; ?>);'>
07-20-2009, 01:10 AM
Well it surely doesn't remember the output between HTTP requests, does it? Can you show the whole page?
07-20-2009, 01:47 AM
$sql = "SELECT distinct(restaurant) FROM restjournal WHERE userid='$_COOKIE[id]'";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
$restString .= $row["restaurant"] . ",";
// get rid of last ,
$restString = substr_replace($restString,'"',-1);
When $restString outputs, it's not being updated for some reason.
07-20-2009, 01:59 AM
Nevermind, I just realized that I am pulling the SQL info before I edit the entries. Pulling the SQL info after that solves it. I am an idiot.
07-20-2009, 02:08 AM
What do you mean it's not being updated? Are we talking about an AJAX call here? Please describe in greater detail what exactly should happen, what exactly does happen, and better yet link to the page.
Alright, you solved it. And it definitely has been in the wrong forum.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.