Jump to content

kamal213

Members
  • Posts

    198
  • Joined

  • Last visited

Everything posted by kamal213

  1. Hi there Ok tried to uploads the file but that doesn't work either so I'll start typing the code in full again. Below is the full jquery script responsible for parsing variable between file. it work fine in Internet explorer but not on Chrome or firefox. <script language = "JavaScript" type = "text/javascript"> function ajax_post(){ // Create our XMLHttpRequest object var hr = new XMLHttpRequest(); // Create some variables needed to send to our PHP file var url = "orderfilefunc.php"; var sd = document.getElementById("startdate").value; var ed = document.getElementById("enddate"). value; var ot = document.getElementById("ordertype").value; var vars = "startdate="+sd+"&enddate="+ed+"&ordertype="+ot; hr.open("POST", url, true); // SET content type header information for sending url encoded variables in the request hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // Access the onreadystatechange event for the XMLHttpRequest object hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { //alert("form was submitted"); var return_data = hr.responseText; document.getElementById("status").innerHTML = return_data; } } // Send the data to PHP now... and wait for response to update the status div hr.send(vars); //Actually execute the request document.getElementById("status").innerHTML = "processing..."; } <script>
  2. Hi there Ok tried to uploads the file but that doesn't work either so I'll start typing the code in full again. Below is the full jquery script responsible for parsing variable between file. it work fine in Internet explorer but not on Chrome or firefox. <script language = "JavaScript" type = "text/javascript"> function ajax_post(){ // Create our XMLHttpRequest object var hr = new XMLHttpRequest(); // Create some variables needed to send to our PHP file var url = "orderfilefunc.php"; var sd = document.getElementById("startdate").value; var ed = document.getElementById("enddate"). value; var ot = document.getElementById("ordertype").value; var vars = "startdate="+sd+"&enddate="+ed+"&ordertype="+ot; hr.open("POST", url, true); // SET content type header information for sending url encoded variables in the request hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // Access the onreadystatechange event for the XMLHttpRequest object hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { //alert("form was submitted"); var return_data = hr.responseText; document.getElementById("status").innerHTML = return_data; } } // Send the data to PHP now... and wait for response to update the status div hr.send(vars); //Actually execute the request document.getElementById("status").innerHTML = "processing..."; } <script>
  3. Hi there Ok tried to uploads the file but that doesn't work either so I'll start typing the code in full again. Below is the full jquery script responsible for parsing variable between file. it work fine in Internet explorer but not on Chrome or firefox. <script language = "JavaScript" type = "text/javascript"> function ajax_post(){ // Create our XMLHttpRequest object var hr = new XMLHttpRequest(); // Create some variables needed to send to our PHP file var url = "orderfilefunc.php"; var sd = document.getElementById("startdate").value; var ed = document.getElementById("enddate"). value; var ot = document.getElementById("ordertype").value; var vars = "startdate="+sd+"&enddate="+ed+"&ordertype="+ot; hr.open("POST", url, true); // SET content type header information for sending url encoded variables in the request hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); // Access the onreadystatechange event for the XMLHttpRequest object hr.onreadystatechange = function() { if(hr.readyState == 4 && hr.status == 200) { //alert("form was submitted"); var return_data = hr.responseText; document.getElementById("status").innerHTML = return_data; } } // Send the data to PHP now... and wait for response to update the status div hr.send(vars); //Actually execute the request document.getElementById("status").innerHTML = "processing..."; } <script>
  4. Please find attached the full jquery code, please open with notepad, tried to type the code again but its been an absolute nightmare. Thanks
  5. Sorry guys please ignore the above I submitted the topic half way through typing by accident. this system is has been a nightmare to use. Tried to see if I could edit it but you cant copy and paste or upload so had to type the code again only to press submit and discover I cant save changes cause I don't have permission so I bit upset. Will try and type this again so please bear with me
  6. Hi guys The code below is meant to parse variables from one page/file to the next. It works perfectly on all IE's but not on Firefox or Chrome for some reason. Could you have a look please for the reason why it doesn't work on Firefox and Chrome and how this could be solved. Thanks a lot. <script language="JavaScript" type="text/javascript"> function ajax_post(){ //Create XMLHttpRequest object
  7. Wow! Barand you are a PHP god in human form! Thanks a lot that's exactly what I was looking for and more. Love the fact I can even update the previous records into a new column with the correct format. Thanks a bunch men, Amazing! Have a nice day!
  8. Hi there, I'm basically trying to do the following in mysql: SELECT sale_date FROM customer-sale WHERE sale_date BETWEEN '05/02/2015' AND '10/02/2015' However I keep getting 0 results, I found out that the issue is with my date format as it should be in (YYYY-mm-dd) format. Now I know, wish I know so about a year ago as I already have over 1500 records on my customer table so to late to change. So I need help with the following: 1.) Is there a search query that can convert dd/mm/yyyy into YYYY-mm-dd so I can run the above query 2.) Is there a way to convert the dates using PHP Need help Thanks a alot
  9. Hi all, I have an issue on my javascript code which I'd like you help with. I have a form validator functionality which check if a value is filled onsubmit and alerts then if its not. it looks like so: <script type="text/javascript"> function validate_form ( ) { valid = true; if (document.acform.c_city1.value == "") { alert ( "Please note the first box must be filled to create a result" ); valid = false; } return valid; } </script> Now this works perfectly fine no issues at all. The problem comes when I tell the above function to do something else. Which looks like so: <script type="text/javascript"> function validate_form ( ) { valid = true; if (document.acform.c_city1.value == "") { alert ( "Please note the first box must be filled to create a result" ); valid = false; } if ( (document.acform.c_city1.value != "") && (document.acform.c_city2.value != "") ) { window.open("<?php echo 'town1.php?c_city1=' . $c_city1 . '' ?>"); window.open("<?php echo 'town2.php?c_city2=' . $c_city2 . '' ?>"); } return valid; } </script> From the above, the second if statement, am asking it to open two windows, but then none of the statements work and I then get the following error: Message: Unterminated string constant Line: 20 Char: 20 Code: 0 Message: Object expected Line: 2 Char: 1 Code: 0 Please I need you help as I can see any obvious errors and don't know why it doesn't work at all. Many thanks
  10. Hi guys, The javascript code below is meant to open two new windows on submit. Its does so no problems on all browser apart from internet explore 9 for so reason. I'm I using a deprecated function? please help. Thanks <script> function popup(popupType) { window.open("<?php echo 'doc_print.php' ?>"); window.open("<?php echo 'doc_installation.php' ?>"); } </script> <form enctype="multipart/form-data" name="form1" method="POST" action="<?php echo 'gps_datahold.php' ?>" onsubmit="popup()"> Comment:<textarea name="g_comment" rows="3" cols="20"></textarea> </form>
  11. Hi guys, I was wondering is it possible to post to the database with javascript if a button on the page is clicked without reloading the page? I can't seem to find any example online. many thanks in advance
  12. Thanks very much it worked, problem solved
  13. Hi guys, how can you get sql to select all cities in your database beginning with the letter C for example? Thanks alot
  14. Just found the onClick function is also compatible with the <a> tag which is what I was looking for.. sorry I ask lol!
  15. Hi guys I was wondering how would I how would I do onClick so it works for links just like it does for buttons Thanks
  16. Your right!! tried it already and it works!!! Perfect! Thanks for your help
  17. Hi guys, Please could you tell me how you would calculate the sum of a column..but of each distinct value in a a table? So for example if the distinct values of a salesman in your table are: John, Bill and Bob how would you calculate there total sales without manually typing "count where salesman =John" etc Please let me know if you need more information. Thanks
  18. Hmmm I see yeah you right coz I haven't seen anything like that in PHP before..many thanks for you help
  19. Hi Guys, Is it possible in php too echo a value on a page based on a select dropdown menu. That is you select you name on a dropdown and it displays some information on the same page about you stored in mysql db without using a submit button? Thanks
  20. Hi guys, Is it possible for a text field on a website to be auto-filled based on what is held within a document locally? For example if we had address.txt on the desktop of a computer is it possible to create a web form to capture what is contained within that file and auto-fill a field? Thanks alot!
  21. I found a solution which works 99% here it is: if (($curdate == $endDate)&&($Event['h_day'] == 'yes')){ $eventTitleList = " <br />$title(half day)"; } I created a new column called h_day for half day and if its yes then run code. The only problem is if two events fall on the same half day it only displayes the second (i.e. if PHP and JAVA are both half day on the 7th march it only displays JAVA half day when it should display both PHP half day). Is there something i should be doing differently? do I need another if statement to deal with this please help?
  22. Hi guys, I have this code below that selects and display all events from my database table. E.g if an event titled 'PHP' starts 5th March and ends 6th March (03/05/2012 - 03/06/2012) //SQL QUERY for Event $sqlCount = mysql_query("select * from eventcalender"); $noOfEvent = 0; while($Event = mysql_fetch_array($sqlCount)){ $startDate = $Event['startDate']; $endDate = $Event['endDate']; //split date list($smonth, $sday, $syear) = explode('/',$Event['startDate']); list($emonth, $eday, $eyear) = explode('/',$Event['endDate']); //change date to date time format $start = new DateTime($sday.'-'.$smonth.'-'.$syear); // DD-MM-YYYY $endDate= new DateTime($eday.'-'.$emonth.'-'.$eyear); // DD-MM-YYYY $curdate = new DateTime($i.'-'.$month.'-'.$year); if ($start <= $curdate && $curdate <= $endDate) { $noOfEvent++; $eventTitleList = $eventTitleList."<br />".$Event['Title']; } } My question is if I had a drop down and the user selects a half day or partial day for the end date (03/06/2012) how do I get the calender to display the word (Half day) on the end date without displaying it on the start date so as to indicate on the calender that the end date is a half day. I would appreciate you help and advice. Thanks
  23. After much persistance I got it work perfectly! Sorry to bother you all Problem solved! Solution was putting MM_openBrWindow("blankpage.php","","width=500,height=400");return false into a varialble called $b_link_test and appending it using space, doublequote and dot as shown : <php? $b_link="<a href='b_item.php' onClick='" . $b_link_test . "'>$items</a>" ?>
  24. Hi guys, The a tag below opens a popup window once click which works fine in html body tag: <p><a href="#" onclick="MM_openBrWindow('#','','width=500,height=400');return false">test</a> The problem is am selecting entries from my database and using php to render the link dynamically and it doesnt seem to work I cant figure out why, here's the php input: <php? $b_link="<a href='b_item.php' onClick='MM_openBrWindow(b_item.php, ,width=500,height=400)return false'>$items</a>"; ?> Here is also the also the javascript which makes it possible <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //-->
  25. Done that and it now works! Thanks for that! Amazing peace of coding by the way took a while but i finally got it
×
×
  • 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.