Jump to content

ChaosKnight

Members
  • Posts

    183
  • Joined

  • Last visited

    Never

Everything posted by ChaosKnight

  1. jQuery is cross browser, so it doesn't matter what browser you use, did you include the jQuery correctly? Also, the download on the jQuery website puts a .js.txt extension at the back of the file, rename it to jquery.js jQuery normally has all the scripting you want to achieve, this speeds up development quite a lot... And always make sure you end the statements correctly, it won't throw out errors even though there are... e.g.: $(document).ready(function(){ $("a").click(function(event){ alert("As you can see, the link no longer took you to jquery.com"); event.preventDefault(); }); });
  2. For the jquery onclick function: http://docs.jquery.com/Tutorials:How_jQuery_Works You can also go through a lot of plugins, just search google.. W3Schools.com also have a jquery tutorial, you can even use OpenSocial jQuery or another where all the work has already been done for you
  3. And the best way to display that div is with some jquery Jquery has an answer for everything, and that's the beauty about it
  4. Can you send all the code related to $qty? Sounds like there is a problem somewhere else with it
  5. I don't understand what your trying to do, what do you mean with "automatically"? Is it something that should load without a browser refresh? Because then you can load the form in a div and use some jquery to hide it when the document is ready and to show it when an event gets triggered. Please advise if I'm not understanding correctly... The code for the jquery will look like this: <script type="text/javascript"> $(document).ready(function() { $('#form').hide(); }); $(document).ready(function() { $('#button').click(function() { $('#form').show(); }); }); </script> This should work, let me know if nothing happens when you insert this code. If you don't have jquery yet, you can download it here: http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.3.2.js&downloadBtn= Just insert the external js file in your original code As for the update of $qty, if you want it to update automatically, the best way I can think about without a refresh would be Ajax, if you are okay with the form causing a refresh then PHP would be sufficient
  6. But now there is another problem, the country_id returns "southafrica", but it should display "South Africa", I tried $row['country'] which should return the "South Africa" (I inserted the extra column in the database, but I guess it doesn't work because I only queried for the country_id column... Please help Oh and it should still use DISTINCT because there are several entries for South Africa and I only need to display it once in the select dropdown Thanks
  7. Thanks for the reply, that made my code a bit cleaner, but still didn't fix it, so I went through everything thoroughly and I found my problem, I forgot to put a "}" after an else statement LOL Sometimes a make the stupidest mistakes hehe Thanks
  8. Hi, the website that I'm busy with has to be done by the end of the week. The code is supposed to query for the countries in the hotels table, and then generate a select dropdown based on the result, but it returns nothing... Here is the code: $db_link = mysql_connect($db_host, $db_user, $db_pass); if ( ! $db_link ) die( "Couldn't connect to mySql Server<br />"); //echo( "Connected to mySql Server<br />"); $db_select = mysql_select_db($db); if ( ! $db_select ) die("Couldn't connect to Database<br />"); //echo("Connected to Database<br />"); echo"<form action='' method='POST'> <label for='countrySelect'>Country</label> <select id='countrySelect' name='country'>\n"; $query = "SELECT DISTINCT `country_id` FROM `hotels` ORDER BY `country_id`"; $result = mysql_query($query, $db_link); or die ("couldn't execute query."); $num_rows = mysql_num_rows($result); if ( $num_rows < 1 ) { print( "<span class=\"error_text\">NO RESULTS FOUND. Please try again...</span>" ); } else{ while($row = mysql_fetch_array($result)) { extract($row); echo "<option value='$country_id'>$country_id</option>"; } echo "</select>"; I tried the rest of the code with a predefined array and it worked perfectly, but as soon as I change it to the above it displays nothing... Thanks
  9. Hi everyone, on the website that I'm busy with there is a lot of pictures and roll overs for the navigation bar. When I tested the pages on the internet yesterday, I saw that all the images reload every time the page reloads, that is quite unnecessary seeing that there isn't another page that replaces the index page, only includes that are included when needed. Is there a way that I can cache the images to minimize the loading time? Thank you..
  10. I fixed it with some jQuery, thanks for your time...
  11. Well the reason why I considered using AJAX is because the bookings page is starting to get really large, so I thought that it would be best to add the second form this way without a browser refresh that is going to take so long to load... Is there another solution? Thanks
  12. Hi, I'm busy with a tourism website, and I am almost finished with the bookings page, so I'm busy fine-tuning everything. On the bookings php page there are 2 includes, one for the accommodation form and one for car rental form, but not everyone will need both the forms, so I made a checkbox and when it gets checked the second form will be included. Do you think this is a good ajax use? Or should I try to do something else? Because I read that AJAX isn't recommended seeing that searchengines ignore them, is this true? Thanks!
  13. LOL, I think this is a sign to get some sleep LOL...
  14. Hi everyone, I downloaded jquery-1.3.2.js.txt from the official jquery website, and I renamed the file to jquery.js and put it inside the folder where I normally put all my current development files, and I tried some of the tutorials on jQuery but found that none of them work... What did I do wrong? I downloaded the "DEVELOPMENT (120KB, Uncompressed Code)" one, is it the wrong type? The last code I recently tried was: <html> <head> <title>jQuery</title> <script type="text/javascript"> src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { $("a").click(function() { alert("Hello world!"); }); }); </script> </head> <body> <a href="">Link</a> </body> </html> I need help urgently seeing that I want to use some of the plugins to complete my project... Thanks!
  15. Hi, ignace gave this link to me: http://remysharp.com/2007/09/18/auto-populate-multiple-select-boxes/ its for a neat jQuery plugin that will make you able to do what you wanted with the select element, one of the guys on that page commented and said that it also worked for a multi-selection, jQuery looks easy enough even though I'm a noob at it LOL... Merry christmas and a happy new year to you, and strongs with the project.
  16. Thanks for your reply... Is jQuery easy to use? Can you please give me an example on how to implement a jQuery plugin?
  17. Hi, thanks, I went through that tutorials after you sent your message, but now I just want to know if this will be possible: the php script already echoes the select element and query the database, but what I need to know is how do I send the variables using ajax to that php page and can I return the entire select with it's values and insert it into the page using Ajax? Thanks!
  18. Have you found a solution yet? I have to make exactly the same thing but I don't know where to start... Please help...
  19. Thanks for the reply, yes I also looked at Ajax in books like Head First Javascript and Javascript Bible, but most of them only return xml documents. I think what I need to do is make the first dropdown available, and when someone chooses an option I somehow have to use Ajax to add something like country=southafrica to the url, is that possible? Also, can I use Ajax to add the second and third dropdowns only when the previous dropdown changes? Thanks! Chaos
  20. Hi all, I'm busy with a website for a South African tourism company, they want the bookings system to be very user-friendly, so I made a few dropdowns in PHP, but now comes the hard part for me, I have to create a onchange event and use Ajax to send the server request and database query, and retrieve the content and then use it in the next drop down... So basically it's a country dropdown, and after that follows the province/state dropdown and it's content should be relative to that of the country, and then again for the towns... There isn't any code that I think will be of use, only PHP echoes for a HTML form and select boxes, if you need anything else I'll be happy to post it.. Can you also please explain the Ajax I need in this situation, because I really want to know how Ajax works for any future projects requiring it Thanks, I really appreciate it! Chaos...
  21. Why can't I find the php5apache2_2.dll in my php folder? I downloaded PHP 5.3.1 yesterday and tried to figure it out. I also searched my entire PC for the dll with no luck... Any ideas? If this question was already answered, can you please post a link to that thread for me? Sorry, I didn't have time to search the entire forum... Thanks
  22. Is there someone that knows why it only doesn't display correct in IE?
  23. Hey guys, can you recommend a great PHP and MySQL book which include the basics and the advanced stuff? Thanks
  24. Thanks! It finally works for every browser except IE, if you can just try and help me with this then I would be ever thankful Once again thanks guys
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.