Jump to content

sunfighter

Members
  • Posts

    579
  • Joined

  • Last visited

    Never

Everything posted by sunfighter

  1. A couple of things 1.) Do not use <input type="text" name="admission_no" id="textfield" onkeyup ...... This will execute as soon as the first number is entered. Use onblur. This occurs when you leave the text field and that should be when the complete number has been entered. 2.) Your code to establish XMLHttpRequest is wrong. I just re=wrote it. 3.) Don't send the Admission Number verification number to the same php file that you want executed upon submission. This is your code for the Admission Number HTML: <input type="text" name="admission_no" id="textfield" onblur="showReg('number')"/></td> I am sending a code word called 'number' to the function. When you write your HTML make sure the SUBMIT button sends a different code word!!! This is the javascript that sets up the XMLHttpRequest and the ajax. <script type="text/javascript"> function showReg(str) { var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ if (str == 'number') document.getElementById('regresult').innerHTML = ajaxRequest.responseText; } } Please notice that the js is not complete and that I choose where the responseText goes depending upon the code word 'number'. We end the script with a section that also depends on the code word. Add this after the above code: if (str == 'number'){ var words = document.getElementById('textfield').value; ajaxRequest.open("GET", "ajax.php?Admit="+words, true); ajaxRequest.send(''); } } // this ends the function </script> Write another section based on the last section to execute when the submit button is pressed. Don't forget to do the conditional statement for the responseText in the beginning js section. The php file I wrote is called ajax.php - use your own name. It looks like this: <?php // Connect to your database here $admission_no = $_GET["Admit"]; // sent with this ajaxRequest.open("GET", "ajax.php?Admit="+words, true); $query="SELECT admission_no FROM student_info Where student_info.admission_no='$admission_no'"; $result = mysql_query($query) ; if(mysql_num_rows($result) > '0') echo 'This Number has been taken'; ?> That should do it.
  2. Please use the above '#' to wrap your code in. You do not define $cart in your code. And a question for you is $_POST['item'] an array? And what is it's value?
  3. This is not done in the php that reads the submitted form, but rather with AJAX when the Admission Number is entered and you leave the field 'onblur';
  4. Try this: give image an ID: <img src="images/happy-couple-420.png" alt="420 Friendly Dating Couple" id="mainPic"/> And add just before the </head> tag: <style type="text/css"> #mainPic{ position:relative; top: 50px; } </style> </head>
  5. Went to validate the site with http://validator.w3.org/ and it could not do it. First time I ran into that! So got the code and did it that way = it showed 82 Errors, 20 warning(s) . They need to be fixed before you can get any cross browser compatibility. The main thing with IE is to have a doc type at the top of the code. Without that IE is brainless. So first fix this up with the validator and if your still having problems repost.
  6. Change this line var formatted_date = ele.value; to var formatted_date = new Date(ele.value);
  7. Change this line to this: <button type="button" onclick="displayResult(<?php echo $num; ?>)">Alert value of text area</button>
  8. 7 errors from validating your site at http://validator.w3.org/. IE has problems with errors. Fix them and try again.
  9. php not closed. $navlist not defined. can not run code.
  10. Went outside TOO HOT to do anything, but did have to go to town. Back and worked on this. This part will give you what you want. You'll have to make the calendar: <?php session_start(); $_SESSION["user_id"] = 1; // only because I don't have this set - you do so delete line // conect to your database here $drug_start_day = 8; // Needed because we have nothing for the first part of the month $today = 15; //$today = date('d'); use this instead of the above line /* ### You have trouble next month because your not using DATE = ex. 2012-03-08 */ $link = mysql_connect($DBhost,$username,$password) or die("Unable to connect to host"); $link = mysql_select_db($database) or die( "Unable to connect database"); $query_drug_dosage = "SELECT * FROM `users_drug_dosage` WHERE users_drug_dosage.user_id = ".$_SESSION["user_id"]." ORDER BY calendar_day DESC"; $query_run_drug_dosage = mysql_query($query_drug_dosage) or die(mysql_error()); if($today >= $drug_start_day){ $id_array = array(); while($row_drug_dosage = mysql_fetch_assoc($query_run_drug_dosage)) { $id = $row_drug_dosage["id"]; $sdd_day = $row_drug_dosage["calendar_day"]; $sdd_month = $row_drug_dosage["calendar_month"]; $sdd_year = $row_drug_dosage["calendar_year"]; $mon_dd = $row_drug_dosage["mon_dd"]; $tue_dd = $row_drug_dosage["tue_dd"]; $wed_dd = $row_drug_dosage["wed_dd"]; $thur_dd = $row_drug_dosage["thur_dd"]; $fri_dd = $row_drug_dosage["fri_dd"]; $sat_dd = $row_drug_dosage["sat_dd"]; $sun_dd = $row_drug_dosage["sun_dd"]; if($sdd_day <= $today) break; } echo $sdd_day; // here just to show you what it got. } ?>
  11. If you used DATE instead of calendar_month calendar_day calendar_year things would be so much easier. You need to have session_start as your first line in this script. You also need to get the date of the calendar day you are getting the dosage for and then do something like this for the query: SELECT * FROM `users_drug_dosage` WHERE users_drug_dosage.user_id =1 // Or the info from sessions AND calendar_month <= 3 AND calendar_year = 2012 AND calendar_day <= 14 ORDER BY calendar_day DESC LIMIT 1 I'm using the SELECT but you having everything in the while ($row_drug_dosage = mysql_fetch_assoc($query_run_drug_dosage)){ line should do this in that loop. Only write the array if the query day is greater or equal to the current calendar day you are writing.
  12. <?php $count = 0; if ($count == 0) { $count0=$count; echo '<script type="text/javascript">'; echo "var conf= confirm('Do you want to add new stuff?');"; echo "if (conf)"; echo 'window.location = "http://www.google.com/";'; echo "</script>"; } ?>
  13. HCProfessionals when you want the user to click on something you MUST make that apparent to him/her. I removed your span and made it a button. I don't know where ".effect()" came from, it's not part of the base jquery and if you got it from an extension module you should have mentioned that. This does not have a fadeOut but it does work. Oh, highlighting a number is hard to see maybe you want to change that or use drop shadows? What it does is show how to delay a command. <!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>New document</title> <script src="./lib/jquery-1.7.2.min.js" type="text/javascript"></script> // My location, yours may be different <script type="text/javascript" language="javascript"> $(document).ready(function() { $("input#CkHere").click(function(){ var origColor = $('.cart_quantity').css("color"); $('span.cart_quantity').css({'color': 'red'}); setTimeout(function() { $('span.cart_quantity').css({'color': 'black'}); }, 300); }); }); </script> <style type="text/css"> </style></head><body> <span class="top_bar_content_items">You have <span class="cart_quantity">0</span> products in your cart</span> <input type="button" value="add to cart" id="CkHere" /> </body></html>
  14. When you have a SELECT and a FROM you need to have a WHERE or you're just going to get everything in the world. The WHERE is the device that tells you the row or rows that you want to look at. The GROUP BY is not needed. After you get your query working you might need a ORDER BY but wait on that. EDIT PS: You really shouldn't use the * but should name the columns you want to see. When you do that you need to have the table name plus a dot plus the column from that table. like SELECT stanjamesprem.column, centrebetprem.whatelse FROM stanjamesprem, centrebetprem WHERE stanjamesprem.ID = centrebetprem.anotherID; It's hard to give advise when i don't know what your trying to do.
  15. Fill in the time BETWEEN for this query and you should have a report of all those that were absent during a time period: select employe ID, count(employe ID) FROM table // I'm not good with time but a BETWEEN start - stop date is needed here WHERE GROUP by employe ID HAVING count(employe ID) >= 1
  16. What if you just recorded the absents? It would look like this: employe ID | absent ---------------|------------------ 234 | 12-03-2012 235 | 13-03-2012
  17. In your second file line 66 find this: echo "<font color='#4A708B' face='arial' ><a href=$companylink style=\"color:white;text-decoration: none; \" target='new'><img src=".$logo_dir."/".$logopath." width=\"15%\"></img></a>&nbsp&nbsp</font>"; You want to change this: <a href=$companylink Use the full address of the page you want and inclose it in single quotes Like changing the link to go to google: <a href='https://www.google.com/'
  18. We are a help form, but the code you posted is what I gave you in answer to a different problem you had. If you don't try to add the code you need to get things working the way you want; you are not asking for help, but for someone to do your work.
  19. We are not going to do your coding. At lest try to learn CSS. look here: http://www.w3schools.com/css/css_display_visibility.asp
  20. I have seen this code before and it doesn't work. The <script type="text/JavaScript"> <!-- and the function ajaxFunction() { "use strict"; Tells you it's older then the hills. I'd give you my script but you want to learn so try this site https://developer.mozilla.org/en/AJAX/Getting_Started or look at this site http://www.openjs.com/articles/ajax_xmlhttp_using_post.php And when done this is a good reference page https://developer.mozilla.org/en/AJAX
  21. Use this line xmlhttp.open("GET","test.php?q="+document.getElementById('PHPVal').innerHTML, true); And I hope the HTML markup on your php file is a mistake.
  22. Now that we know where your background image is I ran your code. Here's a problem "repeat-x repeat-y " does not work! Use one or the other, if you need to use both the code is simply repeat. Here's your CSS with border combined: #layer2 { padding:10px 20px 10px; background: url('http://www.tonalproductions.net/test/images/YCCHeader.png') left top repeat; border: 3px solid #ffffff; }
  23. Really don't need to use sprintf in $sql=sprintf("DELETE FROM $tbl_name WHERE id='$id'"); $sql="DELETE FROM $tbl_name WHERE id='$id' "; Works just fine. BEFORE ever doing a DELETE do a SELECT to make sure you have the correct information. Do this INSTEAD of the delete not in addition too. $query = "SELECT * FROM $tbl_name WHERE id='$id'"; $result=mysql_query($query); $row = mysql_fetch_array($result); print_r($row); die; If you get the correct answer(row) then you can delete it. If this doesn't give you the row that you want to delete try removing the single quotes around the $id and try again.
  24. http://www.tonalproductions.net/test/images/YCC Header.png gives: Not Found The requested URL /test/images/YCC Header.png was not found on this server. ======================= I tried: #layer2 { padding:10px 20px 10px; background-color:green; border: 3px solid; border-color: #ffffff; } and that does work. FireFox
  25. Your form uses a SUBMIT button. When you do that the instruction for the submit is contained in the <form> tag. Normally it would look like this: <form id="ContactForm" action="url of where the form is being sent" method="get or post"> You are missing the action and the method so it calls it's self and you have no php to handle it. If you want the jquery to handle it change the button type to button and add an onclick. Or have the jquery look for a click event.
×
×
  • 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.