Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

andrewliu

Members
  • Joined

  • Last visited

Everything posted by andrewliu

  1. Hello. I have a voting system kind of like digg, and I was wondering how would I work this with sessions? If I'm using jquery and ajax for voting? Does the session have to be written in jquery and ajax? thank you
  2. yeah exactly. I have a question. is it possible to stay say 50px off from the top and then stay there until you scroll down and then the browser would push it down? is that more coding or is it the same thing?
  3. Hello, I'm trying to get a div tag to move while scrolling. I know you can do position: fixed, but I was wondering how to do it so if the div tag is in the middle of the web browser, it will stay there until when you scroll down and it gets to the top of the browser the browser will drag it down. Also, I wanted my div tag to be on the right side of my browser. When I tried doing position: fixed, it stays on my left. I also tried float: right, but it doesn't work Any suggestion? Thank you
  4. My whole form is no longer clickable. I can't go back into my form textbox and type. I can't even click on my button anymore either.
  5. I did what you suggested, I made my return false into return true, and i changed my onSubmit, but its doing the same thing?
  6. Hello. I'm just starting, and I was wondering if anyone can help me on showing me how to combine these two separated scripts together function searchLocations() { $.post("testing.php",{search_term: form.search_term_box.value},function(data) { $("#search_results").html(data); }); return false; } $(document).ready(function() { $('s#more').hide(); $('div#moreAnchor').click(function() { $('div#moreAnchor').show(); }); }); Thank you
  7. Hello, I have this live search engine for my mysql database. My form gets disabled after I click out of the search box. Why is this happening? This is my code function searchLocations() { $.post("testing.php",{search_term: form.search_term_box.value},function(data) { $("#search_results").html(data); }); return false; } <form name="form" style="float:left;width:650px;height:60px;margin-right:30px;" onSubmit="return searchLocations();" > <table style="float:right;"><tr> <td> <label for="search_term_box"><b>Search</b></label><br /> </td> </tr> <tr> <td> <input name="search_term_box" id="search_term" type="text" onkeyup="searchLocations()" style="height:23px; margin-right:20px;font-size: 16px" size="36" autocomplete="off"/></td> <td> <input type="button" name="search_button" style= "padding: 5px; font-family: Arial, Helvetica, sans-serif; font-size: 12px;" value="Search" onClick="searchLocations();" /> </td></tr></table> </form> Thank you
  8. Yeah, sorry. I did change it a little. I changed it a little so when the user does not enter something, the error pops up. But when the user does enter something, I want the color to change back to the original color text (black). How do I make it convert back to error_tri === False after the error has been set. Currently, it stays red. Thank you
  9. webdesigner93 showed me a way last night on aim. he was really helpful. He got it to work, by changing the color on submit, but I forgot to check another part to it. When I type something in the form, the error disappears. So when I tried to change the original text color, it disappears when the user correctly inputs the right data. How do I make it so it'll go back, Here's his snippet of code that he helped me out with. <?php if($error_tri === FALSE) { echo "Username: "; } else if($error_tri === TRUE) { echo $form->error("user"); } ?>
  10. Hello, I have developed a form and if the user does not submit something an error occurs. I was wondering how to change the text color <li id="first_name"> <label for="first_name">First name: </label> <div class="fieldgroup"> <?php echo $form->error("first_name"); echo "<br>"; ?> <input name="first_name" type="text" value="<?php echo $form->value("first_name"); ?>" size="35" maxlength="30"></div></li> Right now this is how my code looks. It produces an error when its necessary. But I want to instead of producing that error, I want the First name text to change colors I might have to a if else statement? But not sure how it looks Thanks
  11. ohh yeah. hehe i deleted those two
  12. no problem. thanks a lot for your time. hopefully i can figure this out
  13. nope. Well I do have a google map api, but that works when I click submit. Just the search doesn't do anything. The search did work without the ajax code, but when I use the ajax script, it doesn't do anything.
  14. Yeah I have the div id and I tried removing the onsubmit, but its still the same. Appreciate your time and help
  15. I checked the firebug and there's no errors for the javascript? I enabled the console and checked to see javascript errors and warnings. but nothing popped up when I tried my search. This is weird?
  16. There's no error regarding any of the ajax script or the results.php script.
  17. there are all my scripts i have included <script type="text/javascript" src="../javascripts/jquery.js"></script> <script src="http://maps.google.com/maps?file=api&v=2&key=abcdef" type="text/javascript"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script type="text/javascript" src="../javascripts/jquery_pagination.js"></script> <script type="text/javascript" src="../javascripts/paging.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> one of them is the jquery one right? lol
  18. theres no result or anything. no error message either. this is my new results.php <?php include("search_query.php");?> <?PHP if($results != 0) { ?> <table style="width:950px;"><tr><td style="float:left">Results for <?PHP echo "<i><b><font color=#000000>".$search_term."</font></b></i> "; ?></td> <td style="float:right">Results <b> <?PHP echo ($first_pos+1)." - "; if(($RESULTS_LIMIT + $first_pos) < $results) echo ($RESULTS_LIMIT + $first_pos); else echo $results ; ?> </b> out of <b><?PHP echo $results; ?></b> for(<b><?PHP echo sprintf("%01.2f", $time_search); ?></b>) seconds </td> </tr> </table> <?php require("filter.php");?> <table style="float:left;position:relative"> <?PHP while($row = mysql_fetch_array($sql_result_query)) { ?> <tr align="left"> <td colspan="2" style="padding-right:30px;"><?PHP echo $row['product']; ?></td> <td colspan="2"><?PHP echo $row['location']; ?></td> </tr> <?PHP } ?> </table> <?PHP } elseif(isset($sql_query)) { ?> <table border="0" cellspacing="2" cellpadding="0"> <tr> <td align="center">No results for <?PHP echo "<i><b><font color=#000000>".$search_term."</font></b></i> "; ?></td> </tr> </table> <?PHP } ?> <?php require("includes/pagination.php");?> then in my index.php i just included my form.php with the action="results.php"
  19. I tried putting the results, pagination, and search_query together in one php by using includes. but it still does not show results?
  20. Ohh I see. hmmm is there a way to work around this? Or in order to use ajax, we need to have a single script containing the search result? Thanks for your help. I get what you're saying.
  21. Thanks for helping! This is my search_query.php <?PHP global $search_term; global $location_term; global $results; function getmicrotime() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $connection_string = "connectionstring.php"; require_once($connection_string); mysql_select_db("chef") or die ( 'Unable to select database.' ); $RESULTS_LIMIT=5; if(isset($_GET['search_term']) && isset($_GET['addressInput']) && isset($_GET['search_button'])) { $search_term = $_GET['search_term']; $location_term = $_GET['addressInput']; if(isset($_GET['first_pos'])) { $first_pos = $_GET['first_pos']; } else { $first_pos = 0; } $start_search = getmicrotime(); $sql_query = mysql_query("SELECT * FROM searchengine WHERE MATCH(product) AGAINST('$search_term') AND MATCH(location) AGAINST('$location_term')"); if($results = mysql_num_rows($sql_query) != 0) { $sql = "SELECT * FROM searchengine WHERE MATCH(product) AGAINST('$search_term') AND MATCH(location) AGAINST('$location_term') LIMIT $first_pos, $RESULTS_LIMIT"; $sql_result_query = mysql_query($sql); } else { $sql = "SELECT * FROM searchengine WHERE (product LIKE '%".mysql_real_escape_string($search_term)."%' AND location LIKE '%".mysql_real_escape_string($location_term)."%') "; $sql_query = mysql_query($sql); $results = mysql_num_rows($sql_query); $sql_result_query = mysql_query("SELECT * FROM searchengine WHERE (product LIKE '%".$search_term."%' AND location LIKE '%".$location_term."%') LIMIT $first_pos, $RESULTS_LIMIT "); } $stop_search = getmicrotime(); $time_search = ($stop_search - $start_search); } ?> form.php <?php require_once("search_query.php");?> <form action="results.php" class="ajax" method="post" name="form" id="search" style="float:right;width:650px;height:60px;margin-right:30px;" onSubmit="return searchLocations();" > <table style="float:right;"><tr> <td> <label for="testinput"><b>Search</b> <span class="italics">(i.e. chicken breast, Ratatouille, deli):</span></label><br /> </td> <td> <label for="testinput"><b>Location</b> <span class="italics">(i.e. Zip code, Address):</span></label><br /> </td></tr> <tr> <td> <input name="search_term" id="search_term" type="text" style="height:23px; margin-right:20px;font-size: 16px" value="<?PHP echo $search_term; ?>" size="36" autocomplete="off"/></td> <td> <input name="addressInput" id="addressInput" type="text" style="height:23px;margin-right:10px;font-size: 16px" value="<?PHP echo $location_term; ?>" size="36" autocomplete="off"/></td><td> <select id="radiusSelect"> <option value="25" selected>25 Miles</option> <option value="100">100 Miles</option> <option value="200">200 Miles</option> </select></td><td> <input type="submit" name="search_button" style= "padding: 5px; font-family: Arial, Helvetica, sans-serif; font-size: 12px;" value="Search" onclick="searchLocations();" /> </td></tr></table><br /> </p> </form> results.php <?PHP if($results != 0) { ?> <table style="width:950px;"><tr><td style="float:left">Results for <?PHP echo "<i><b><font color=#000000>".$search_term."</font></b></i> "; ?></td> <td style="float:right">Results <b> <?PHP echo ($first_pos+1)." - "; if(($RESULTS_LIMIT + $first_pos) < $results) echo ($RESULTS_LIMIT + $first_pos); else echo $results ; ?> </b> out of <b><?PHP echo $results; ?></b> for(<b><?PHP echo sprintf("%01.2f", $time_search); ?></b>) seconds </td> </tr> </table> <?php require("filter.php");?> <table style="float:left;position:relative"> <?PHP while($row = mysql_fetch_array($sql_result_query)) { ?> <tr align="left"> <td colspan="2" style="padding-right:30px;"><?PHP echo $row['product']; ?></td> <td colspan="2"><?PHP echo $row['location']; ?></td> </tr> <?PHP } ?> </table> <?PHP } elseif(isset($sql_query)) { ?> <table border="0" cellspacing="2" cellpadding="0"> <tr> <td align="center">No results for <?PHP echo "<i><b><font color=#000000>".$search_term."</font></b></i> "; ?></td> </tr> </table> <?PHP } ?> index.php <script type="text/javascript"> $(document).ready(function(){ $("form.ajax").submit(function(){ var ajax_div = $(this).attr("id")+"_results"; var data = $(this).serialize(); var url = $(this).attr("action"); var type = $(this).attr("method").toUpperCase(); $.ajax({ url: url, data: data, type: type, success: function(data){ $("#"+ajax_div).html(data); } }); return false; }); }); </script> <?php require("includes/form.php");?> <div id="search_results"> <?php require("includes/results.php");?> <?php require("includes/pagination.php");?> </div> pagination.php <?PHP global $first_pos; global $sites; if($first_pos > 0) { $back=$first_pos-$RESULTS_LIMIT; if($back < 0) { $back = 0; } echo "<a href='index2.php?search_term=".stripslashes($search_term)."&addressInput=$location_term&search_button=Search&first_pos=$back' ></a>"; } if($results>$RESULTS_LIMIT) { $sites=intval($results/$RESULTS_LIMIT); if($results%$RESULTS_LIMIT) { $sites++; } } for ($i=1;$i<=$sites;$i++) { $fwd=($i-1)*$RESULTS_LIMIT; if($fwd == $first_pos) { echo "<a href='index2.php?search_term=".stripslashes($search_term)."&addressInput=$location_term&search_button=Search&first_pos=$fwd '><b>$i</b></a> | "; } else { echo "<a href='index2.php?search_term=".stripslashes($search_term)."&addressInput=$location_term&search_button=Search&first_pos=$fwd '>$i</a> | "; } } if(isset($first_pos) && $first_pos < $results-$RESULTS_LIMIT) { $fwd=$first_pos+$RESULTS_LIMIT; echo "<a href='index2.php?search_term=".stripslashes($search_term)."&addressInput=$location_term&search_button=Search&first_pos=$fwd ' > >></a>"; $fwd=$results-$RESULTS_LIMIT; } ?> </td> </tr> </table>
  22. okay. I set those. One question, I have my search script in different places. I do have a results script in a php file, and the search query in another php file with the form. So the query through my database and form is in the same php and my result script is in another. Is it the correct way to set my action="results.php"? <form action="results.php" class="ajax" method="post" name="form" id="search" style="float:right;width:650px;height:60px;margin-right:30px;" onSubmit="return searchLocations();" > Now, i'm not sure what to put in the ajax data, and URL $(document).ready(function(){ $("form.ajax").submit(function(){ var ajax_div = $(this).attr("id")+"_results"; var data = $(this).serialize(); var url = $(this).attr("action"); var type = $(this).attr("method").toUpperCase(); $.ajax({ url: url, data: data, type: "post", success: function(data){ $("#"+ajax_div).html(data); } }); return false; }); }); Thanks for your help!
  23. oh let me try that too. but I think I have to pass some kind of info in the url, data from the ajax code, but not sure what to put in that? Sorry I just edited my post. Thanks!

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.