Jump to content

iammudassir

Members
  • Content Count

    23
  • Joined

  • Last visited

Community Reputation

0 Neutral

About iammudassir

  • Rank
    Newbie
  1. i change my line like thisdocument.getElementById("txtHint").value=xmlhttp.responseText; '''''' here you can see i change innerHTML to Value , now it showing result in my INPUT field but like this <!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"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body><td>real</td></body></html> my result is only one word "REAL" but it shows above three lines in my input Field , please please correct my code i dont know JAVA and AJAx
  2. <!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"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head> <body><html><head><script>function showUser(str){if (str=="") { document.getElementById("txtHint").value=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } }xmlhttp.open("GET","getuser.php?q="+str,true);xmlhttp.send();}</script></head><body> <form><select name="users" onchange="showUser(this.value)"><option value="">Select a person:</option><option value="1">1</option><option value="2">2</option></select><input name="buyername" type="text" id="txtHint" /> """" I WANT TO DISPLAY RESULT IN THIS FIELD"""" </form><br><div id="txtHint"><b>Person info will be listed here.</b></div> RESULT IS DISPLAYING HERE </body></html></body></html> QUESTION:I WANT TO DISPLAY RESULT IN MY INPUT FIELD<input name="buyername" type="text" id="txtHint" />AS YOU KNOW RESULT COMES FROMdocument.getElementById("txtHint").innerHTML=xmlhttp.responseText;
  3. i think a solution when my query run it save values ('$myname' , '$mydate' ) here $mydate save as '' means (empty) and empty data save as 0000-00-00my solution is after this query i will run another query of update like thisupdate mytable set mydate = NULL where mydate = "0000-00-00" ;or give me another solution so save NULL in date field in database though PHP vairable
  4. after trying these both solution now mydatabase shows "0000-00-00" now i understand what my problem issee this$myname = "abc"$mydate = NULL or $mydate = 'NULL' (i try these both style) here $mydate is NULL but problem start when i run my sql query $query = "INSERT INTO mytable (myname , mydate ) values ('$myname' , '$mydate' )";$mydate = NULL but in query it is uner ' ' so NULL save as 'NULL' and date cannot accept it to check i run simple sql query INSERT INTO mytable (myname , mydate ) values ('abc' , 'NULL' ); i also save 0000.00.00 in datebut when i run INSERT INTO mytable (myname , mydate ) values ('abc' , NULL ); see here NULL is without ' ' now it show NULL in database so in php we are using variable to save values in database and variable are under ' ' so i am unable so save NULL in database trhough PHP , i tired i loose
  5. is this code will work under foreach ?????? i m working on array here as u check my code above.
  6. thank you for correct replycan we use && here instead of using two time IF if yes then how i wanna use && operator like thisif(isset($_POST['select'])) && if(isset($a)) ???? what wrong with this code
  7. i already set this field NULL in my database to accept null values actually $etd = date('Y-m-d',strtotime($_POST['etd'][$row]));this line create $etd i have to stop itlike thisif $_POST['etd'][$row] is present then $etd = date('Y-m-d',strtotime($_POST['etd'][$row]));else $etd = ""how i create this line in php code ??? tell me the php code for this issue
  8. i have 3 column delivery_no , qty , etd (etd is date) i have a form with some rows in shape of array like this<tr>delivery_no[]qty[]etd[]</tr> <tr>delivery_no[]qty[]etd[]</tr> below is my php code if(isset($_POST['save'])) { foreach ($_POST['delivery_no'] as $row=>$del_no){ $delivery_no=$del_no; $qty =$_POST['qty'][$row]; $etd = date('Y-m-d',strtotime($_POST['etd'][$row])); // problem is here $query_array = "INSERT INTO ls_detail ( delivery_no, qty, etd)VALUES ( '$delivery_no', '$qty' , '$etd' )";echo "<br />"; if (mysql_query($query_array)){echo "ROW inserted";}}} ?> my question if i enter some date in etd[] field like 10-11-2012 i works fine and save correct value which i entered.butif i leave my etd[] blank and press save button $etd will be 31-12-1969 automatically , how i stop it , why with out any post value in etd field it save date 31-12-1969 in databaseactually my question is why my $etd = 31-12-1969 without $_POST['etd'][$row]and how i set $etd " NULL" if $_POST['etd'][$row] have no valueplease answer me with code thanks in advance
  9. actually i want to check both select and $row[1] because when i press select button it will execute a query and $row[1] is the result of that queryso i want to check if select is pressed and my query has $row[1] then echo it
  10. i have a field field1 value ="<?php if(isset($_POST['submit'])){echo $row[1]; }?>" $row[1] is result because of a query some times $row[1] is present and some times no if not present it generate an error how i set my php code in value to check after submit is $row[1] is present or not to echo it
  11. can you tell me how to set isset to check if variable is present or not with submit buttonlike this i want this type of code if select button is press check $a is present if present echo $a
  12. can you tell me please how to to set isset to check if variable is present please note i already set if isset $_POST['select']
  13. thank you jamesB i will reply you after apply this solution
  14. Thankyou very much this is really is easy solution for me i will inform you after apply this
×
×
  • Create New...