Jump to content

funbinod

Members
  • Posts

    501
  • Joined

  • Last visited

Everything posted by funbinod

  1. style="width:95%; margin-left:auto; margin-right:auto;"
  2. funbinod

    summing results

    I also tried $total += $balance; and it also doesn't work. actually the $balance is derived from lots of calculations after the query so I don't know how can I make the sum of $balance in sql. that's why I wish the $total calculated with php...
  3. funbinod

    summing results

    I've a query that gets some rows with some results. and I want to sum all the results like I get $balance from a query while ($r = $q->fetch_array) { echo $balance.'<br />';} and when I get the rows with $balance, I want to sum all of them and display at the bottom I tried, $total = 0;while ($r = $q->fetch_array) { $total = $balance++; echo $balance.'<br /';}echo $total; but its not giving the required result. please guide. thanks in advance....
  4. funbinod

    mysql timezones

    I want to know how can I set timezone for MySQL from phpmyadmin? I tried set time_zone = 'Asia/Kathmandu'; and it said unknown timezone. I checked the supported timezone list, and it contains my timezone. then I tried set time_zone = '+5:45'; and it succeeded. but when a row is updated, the timestamp column is not storing the correct time according to my timezone. please guide what is the problem??? thankz in advance....
  5. oh thank u. now I changed the id for both options to 1 and 2 and now I changed the jquery selector by its name... $('#dname').keypress(function(e) { if (e.which === 13) { if ($('input[name=by]').val()=='CHQ') { $('#cqd').select(); } else if ($('input[name=by]').val()=='CASH') { $('#ref').select(); } } }); selecting by its name also not doing the proper job . what do u suggest me to make this done...????
  6. BY: <input type="radio" name='by' id='by' value="CASH" checked />CASH | <input type="radio" name='by' id='by' value="CHQ" />CHEQUE sorry! I might have been misunderstood... please guide how can I have options for radio buttons for one question???
  7. I've some problem executing some line with different condition on radio button selection... $('#dname').keypress(function(e) { if (e.which === 13) { if ($('#by').val()=='CASH') { $('#cqd').select(); } else if ($('#by').val()=='CHQ') { $('#ref').select(); } } }); in this code #by is radio button with two options - val='CASH' & val='CHQ'. on 'keypress', if CASH is selected '#cqd' should be selected and if CHQ is selected '#ref' should be selected. but this only the #cqd is selected in both conditions. please guide me to execute it properly. thanks in advance...
  8. funbinod

    max-width

    max-width not working on the following. <table style="padding:0; border:none; border-spacing:0; max-width:98%; min-width:1000px; margin-left:auto; margin-right:auto;"> the table width is fixed on min-width though the screen resolution or width is more than that. shouldn't it be set on max-width if the page width is more than min-width????
  9. ok I've done this $('#name').keyup(function(e) { getAid(); // this is the function for ajax request $('#address').attr('disabled', 'disabled'); if (e.which === 13) { if( ($('#aid').val() !== '')) { e.preventDefault(); $('#address').removeAttr('disabled'); $('#address').focus(); } else { alert('Error!'); $('#name').select(); } } }); please guide me where I've done mistake. everything seems to be working fine but the focus goes to #address whether the ajax is successful or not...
  10. hi guys! greetings! I've used ajax to get some data after user inputs some information on a <input> and hits enter. function getAid(){var XMLHttpRequestObject = false;if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest();} else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHttp");}XMLHttpRequestObject.onreadystatechange = function(){ if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { document.getElementById('aid').value = XMLHttpRequestObject.responseText; }}var name = encodeURIComponent(document.getElementById('name').value);XMLHttpRequestObject.open('POST', 'ajax/aid.php');XMLHttpRequestObject.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");XMLHttpRequestObject.send("name=" + name);} this function is set onBlur() method on #name field. its working fine. but I wish something more. I wish that the cursor should move to another field only after the successful ajax callback, or say only after getting data on #aid field. for example <input id="name"> <input id="address"> <input id="aid"> when user inputs 'name' and hits 'enter', value is derived from ajax request to 'aid' field and after getting the value, the 'address' field with get the focus.. please guide through... thanks in advance....
  11. funbinod

    round always up

    uh ha! that's great! thank u!
  12. funbinod

    round always up

    hey guys! how can I always round up a number in php? I learnt about ROUND_HALF_UP, ROUND_HALF_DOWN, and others. but what can I do if I want to round a number always up whether it is greater than half or less than. for example 12345.01 = 12346 12345.99 = 12346 please guide me. thanks in advance....
  13. hey guys! I diagnosed that the all problem is about jquery support for ".click()" and ".on()" event handlers. I am using jquery-2.1.0. but its not supporting these events. then I migrated it to 1.2.1 and used ".live()" event and everything worked. please suggest me which event is used for this on jquery-2.1.0???
  14. $('#sendmail').submit(function(e) { e.preventDefault(); yes! they are after I clicked the submit button..
  15. thank u. I corrected it and its now working as I wanted...
  16. event also not working attached are the screenshots of developer tool (console and network)
  17. not working :( :'( $('#sendmail').submit(function(e) { event.preventDefault(); $("#sendmail").validate(); if ($("#sendmail").valid()) { $.ajax({ type: "POST", url: "sendmail.php", cache: false, contentType: "application/json; charset=utf-8", data: { msg: $('#msg').val(), subj: $('#sub').val(), emaill: $('#emaill').val() }, dataType: "json", complete: function(transport) { if (transport.status == 200) { alert('Mail Sent Successfully!'); } else { alert("Please try again later!"); } } }); } });
  18. thank u. that's a good point.. but I need to change some other properties also. and there is still some problem, I think. please refer to http://jsfiddle.net/zuv455oh/4/ again...
  19. yes! you caught the point. it is reloading the page in stead sending ajax request (page load animated icon on the address starts running after I click send button). I tried to stop the form submit using "e.preventDefault()", "e.preventDefault()", "return false" but its not stopping the submission. is this method wrong? any other idea???
  20. yes it does! to test it I've added some line after execution of php mail() if (mail($to, $subject, $body, $from)) { $_SESSION['msg'] = 'mail sent successfully to "'.$to.'"';} else { $_SESSION['msg'] = 'mail sent failed to "'.$to.'"';}die(header('location: notes.php'));////// this part is only to test if the script is working or not. for ajax script to execute I only use "mail($to, $subject, $body, $from)" /////// yes! there is no any alert on any response status. neither any email... if (transport.status == 200) { alert("Mail Sent Successfully!"); } else { alert("Please try again later!"); }////////////// no response / no email //////////////// the php script (sendmail.php) is working very nicely, I think. if I remove the ajax part and use action='sendmail.php' in mail form, it sends mail and returns the session var.
  21. I was trying something idiot. I created 4 divs and arranged them to look like some object. and I wish them to slide away to right at once so that it looks like the displayed object moved.. the effect is make on click event. I tried sliding wrapping div but it slid only first div and others disappeared. then i tried moving individual divs also. but it moved individually not at once as one object... please refer to this jsfiddle http://jsfiddle.net/zuv455oh/3/ and guide me to better solution... thank u in advance...
  22. the status is ok at developer tool. it says "Status - 200 OK" there I found one mistake (additional extra closing curly brace). I fixed it. but still no response. one additional point-- I am trying to send mail from a appended div after clicking the email address... following is the complete code... $('#send').click(function(e) { $("#sendmail").validate(); if ($("#sendmail").valid()) { $.ajax({ type: "POST", url: "sendmail.php", cache: false, contentType: "application/json; charset=utf-8", data: { msg: $('#msg').val(), subj: $('#sub').val(), emaill: $('#emaill').val() }, dataType: "json", complete: function(transport) { if (transport.status == 200) { alert('Mail Sent Successfully!'); } else { alert("Please try again later!"); } } }); } }); this is the appended div that contains the mail form..... <div id='pop'><div id='popin'><br /><form id='sendmail' name='sendmail' method='POST' action=''><input id='emaill' name='emaill' type=text value='<?php echo $aemail; ?>' /><br /><br /><textarea cols='20' rows='2' id='sub' name='sub'></textarea><br /><br /><textarea cols='20' rows='10' id='msg' name='msg'></textarea><br /><br /><input type='submit' id='send' name='send' value=SEND /> <input type='button' id='close' value='CLOSE' /></form></div></div>
  23. oh right! I forgot the comma. but its still not working. I don't know what happened. but its not showing alert that were intended after success or error....
  24. thank u now the script became $.ajax({ type: "POST", url: "sendmail.php", cache: false, contentType: "application/json; charset=utf-8", data: { msg: $('#msg').val(), subj: $('#sub').val(), emaill: $('#emaill').val() } dataType: "json", complete: function(transport) { if (transport.status == 200) { alert('Mail Sent Successfully!'); } else { alert("Please try again later!"); } } }); is everything correct!!???? but even its not working...
  25. thank u for the reply. but sorry, I don't know what that really means. does it mean data: $("#msg").val(), data: $("#emaill").val(), ?????????
×
×
  • Create New...