Just_Johnny
Members-
Posts
14 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Just_Johnny's Achievements
Newbie (1/5)
0
Reputation
-
prototype.js loads slow. Is there anything I can do?
Just_Johnny replied to Just_Johnny's topic in Javascript Help
<?php $yearMake = $_POST['make']; $yearMakeArray = explode("year=",$yearMake); $make = $yearMakeArray[0]; $year = $yearMakeArray[1]; $query = "SELECT DISTINCT model,year FROM lookup_table WHERE type IN ('Tuner_GT_Sp') AND make='".$make."'"; $result = MYSQL_QUERY($query); $count = MYSQL_NUM_ROWS($result); echo MYSQL_ERROR(); $model_array = array(); for ($x=0; $x<$count; $x++){ $model = MYSQL_RESULT($result, $x, "model"); $year_string = MYSQL_RESULT($result, $x, "year"); if (format_year($year_string, $year)){ array_push($model_array, $model); } } $model_array_unique = array_unique($model_array); $count = count($model_array_unique); if($count == "0"){ echo "no matches"; }else{ echo '<div style="position:absolute; right:115px; top:100px; width:200px; height:100px; background-color:#FB0303;">'; echo "<font size=2><u>CHOOSE MODEL<br/><br/></u></font>"; for ($x=0; $x<$count; $x++){ echo $model_array_unique[$x]."<br>"; } echo '</div>'; } ?> Here is test2.php. I think I'm going to stop using prototype guys, it's causing me to not know what I'm doing. When I don't know what I'm doing I run here and post stupid questions. -
prototype.js loads slow. Is there anything I can do?
Just_Johnny replied to Just_Johnny's topic in Javascript Help
<?php $query = "SELECT DISTINCT(make) FROM lookup_table WHERE type IN ('Tuner_GT_Sp') ORDER BY make"; $result = MYSQL_QUERY($query); $count = MYSQL_NUM_ROWS($result); echo MYSQL_ERROR(); $makeArray = array("Choose Make"); for ($x=0; $x<$count; $x++){ $make = MYSQL_RESULT($result, $x, "make"); array_push($makeArray, $make); } mysql_close($dbConnection); ?> <html> <title>Spoiler Chooser</title> <head> <script type="text/javascript" src="prototype.js"></script> <script> function sendRequest() { new Ajax.Request("test2.php", { method: 'post', parameters: 'make='+ $F('make') + 'year='+ $F('year'), onComplete: showResponse }); } function showResponse(req){ $('show').innerHTML= req.responseText; } </script> </head> <body> <form id="name" onsubmit="return false;"> <select name="make" id="make"> <? for($x=0;$x<count($makeArray);$x++){ echo "<option value=\"".$makeArray[$x]."\">".$makeArray[$x]."</option>"; } ?> </select> <br/><br/> <select name="year" id="year"> <option value='Year'>Year</option> <option value='1980'>1980</option> <option value='1981'>1981</option> <option value='1982'>1982</option> <option value='1983'>1983</option> <option value='1984'>1984</option> <option value='1985'>1985</option> <option value='1986'>1986</option> <option value='1987'>1987</option> <option value='1988'>1988</option> <option value='1989'>1989</option> <option value='1990'>1990</option> <option value='1991'>1991</option> <option value='1992'>1992</option> <option value='1993'>1993</option> <option value='1994'>1994</option> <option value='1995'>1995</option> <option value='1996'>1996</option> <option value='1997'>1997</option> <option value='1998'>1998</option> <option value='1999'>1999</option> <option value='2000'>2000</option> <option value='2001'>2001</option> <option value='2002'>2002</option> <option value='2003'>2003</option> <option value='2004'>2004</option> <option value='2005'>2005</option> <option value='2006'>2006</option> <option value='2007'>2007</option> <option value='2008'>2008</option> <option value='2009'>2009</option> </select> <input type="submit" value="Search" onClick="sendRequest()"> </form> <div id="show"></div> <br/><br/> </body> </html> Sorry corbin I didn't mean to take your reply the wrong way. This is my code, it takes about 20 secs to display the select dropdown forms. -
prototype.js loads slow. Is there anything I can do?
Just_Johnny replied to Just_Johnny's topic in Javascript Help
1. I login to phpfreaks.net 2. Go to ajax help where I posted a topix requesting help. (YES, I've got a reply!) Then I read what you just posted. "You could find out why it loads slowly." Corbin, nothing personal but please don't reply to anymore of my posts. I'm just simply asking if anybody else has had a similar problem. -
I have a lookup system using the prototype.js framework. It works great except it loads very slow. Is there anything I can do about this? ???
-
prototype.js - Returns only one of my forms data
Just_Johnny replied to Just_Johnny's topic in Javascript Help
Can somebody please just point me in the right direction? -
I think I'm finally starting to get this. <html> <title>php-learn-it.com - php ajax form submit</title> <head> <script type="text/javascript" src="prototype.js"></script> <script> function sendRequest() { new Ajax.Request("test2.php", { method: 'post', postBody: 'make='+ $F('id1'), onComplete: showResponse }); } function showResponse(req){ $('show').innerHTML= req.responseText; } </script> </head> <body> <form id="test" onsubmit="return false;"> <select name="make" id="id1">; <? for($x=0;$x<count($makeArray);$x++){ echo "<option value=\"".$makeArray[$x]."\">".$makeArray[$x]."</option>"; } ?> </select> <select name="year" id="id2">; <option value="1998">1998</option> <option value="1999">1999</option> </select> <input type="submit" value="submit" onClick="sendRequest()"> </form> <div id="show"></div> <br/><br/> </body> </html> I return print_r($_POST) and it looks like this. Array ( [make] => Acura ) My first drop down form returns exactly what I want, but I'm having trouble with getting the second drop down. I reverted the js code back to working with just the first drop down "id1".
-
[SOLVED] Why won't this work with protype.
Just_Johnny replied to Just_Johnny's topic in Javascript Help
If I take that block of php code and past it into another page it works fine. -
[SOLVED] Why won't this work with protype.
Just_Johnny replied to Just_Johnny's topic in Javascript Help
I meant "Why doesn't this work with Prototype.js" In the code I note where everything goes wrong. -
I'm using this example here. http://www.php-learn-it.com/tutorials/starting_with_php_and_ajax.html This is where I run into my problem. <?php include("connect_database.php"); <html> <head> <script type="text/javascript" src="prototype.js"></script> <script> function sendRequest() { new Ajax.Request("test.php", { method: 'post', postBody: 'name='+ $F('name'), onComplete: showResponse }); } function showResponse(req){ $('show').innerHTML= req.responseText; } </script> </head> <body> <form id="test" onsubmit="return false;"> <select name="name" id="name" > //everything goes wrong here $query = mysql_query("SELECT * FROM cars"); while($rows=mysql_fetch_array($query)){ $make = $rows['make']; echo"<option value='".$make."'>".$make."</option>"; //end everything goes wrong </select> <input type="submit" value="submit" onClick="sendRequest()"> </form> <div id="show"></div> </body> </html>
-
Can someone help me with prototype.js?
Just_Johnny replied to Just_Johnny's topic in Javascript Help
Ok, please forget about the last post. Here is the code I'm working with. <html> <!-- Please see the full php-ajax tutorial at http://www.php-learn-it.com/tutorials/starting_with_php_and_ajax.html If you found this tutorial useful, i would apprciate a link back to this tutorial. Visit http://www.php-learn-it.com for more php and ajax tutrials --> <title>php-learn-it.com - php ajax form submit</title> <head> <script type="text/javascript" src="prototype.js"></script> <script> function sendRequest() { new Ajax.Request("test.php", { method: 'post', postBody: 'name='+ $F('name'), onComplete: showResponse }); } function showResponse(req){ $('show').innerHTML= req.responseText; } </script> </head> <body> <form id="test" onsubmit="return false;"> <select name="name" id="name"> <?php include("connect_database.php"); $query = mysql_query("SELECT * FROM cars"); while($rows=mysql_fetch_array($query)){ $make = $rows['make']; echo "<option value='".$make."'>".$make."</option>"; } ?> </select> <input type="submit" value="submit" onClick="sendRequest()"> </form> <div id="show"></div> <br/><br/> <a href="../../starting_with_php_and_ajax.html"><< back to php ajax tutorial</a> </body> </html> For some reason this isn't working. -
Can someone help me with prototype.js?
Just_Johnny replied to Just_Johnny's topic in Javascript Help
<html> <!-- Please see the full php-ajax tutorial at http://www.php-learn-it.com/tutorials/starting_with_php_and_ajax.html If you found this tutorial useful, i would apprciate a link back to this tutorial. Visit http://www.php-learn-it.com for more php and ajax tutrials --> <title>php-learn-it.com - php ajax form submit</title> <head> <script type="text/javascript" src="prototype.js"></script> <script> function sendRequest() { new Ajax.Request("test.php", { method: 'post', postBody: 'name='+ $F('name'), onComplete: showResponse }); } function showResponse(req){ $('show').innerHTML= req.responseText; } </script> </head> <body> <form id="test" onsubmit="return false;"> Name: <input type="text" name="name" id="name" > <input type="submit" value="submit" onClick="sendRequest()"> </form> <div id="show"></div> <br/><br/> <a href="../../starting_with_php_and_ajax.html"><< back to php ajax tutorial</a> </body> </html> This does this http://www.php-learn-it.com/tutorials/demos/starting_with_php_ajax/test.html I want to do the same thing but only with a drop down. -
I'm new to javascript. I've read MANY tutorials, but I'm just not getting it. What I'm trying to accomplish is very simple. (not for me) I have 3 drop-downs. 1st. Populates from simple mysql query. 2nd. Are just static values. 3rd. Needs to populate from database from a query that uses values from 1st and 2nd drop down. When I read tutorials on how to do this I keep getting lost. I've never done anything like this before. Can anybody help?
-
My array looks like this. [0] => Value 1 [1] => Value 2 [2] => Value 3 [3] => Value 4 [4] => Value 5 The first two are simple. $This = $array[0]; $That = $array[1]; No problem so far For $array[2] and up. I want it to append the next value. so... $These = $array[2]." ".$array[3]." ".$array[4]; The problem is the array doesn't always end at 4. This is what I've done, but I know there is an better way. $model = $Array[2] ." ".$Array[3] ." ".$Array[4] ." ".$Array[5] ." ".$Array[6] ." ".$Array[7] ." ".$Array[8] ." ".$Array[9]; Sorry, I know this is super simple stuff than what you guy are used to at this forum. Thanks in advance!