Jump to content

valanews.com

Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by valanews.com

  1. The solution is to apply htmlspecialchars() to the string before returning it from the server.
    like this:
    $str="<div>";  echo htmlspecialchars($str) ?>

    No! I think u don't underestand my means I don't what print a html tag as a normal text or as a stringI wana bring a single tag (start tag or end tag) from idn1.php to index.php...becausefor example when I type a start tag [like: echo "<div>"; ] The server (or debugger) automatically create end tag.

  2. Hi I wana check value of an input text for validation by ajax. I read a great tutorial in w3schools.com in here:http://w3schools.com...ax_database.asp and I changed it for my business. so I have 3 file:in index.php

    <div class="fieldwrapper">  <div class="thefield 1" id="idn1">	<input name="password" type="password" value="" size="30" onchange="showUser(this.value)"/>  </div></div>

    and and some of code in second file: load.js

     function showUser(str){if (str=="")  {  document.getElementById("idn1").innerHTML="";  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("idn1").innerHTML=xmlhttp.responseText;	}  }xmlhttp.open("GET","getuser.php?q="+str,true);xmlhttp.send();}

    and finaly, in third file: (external php): idn1.php

    <?php$q=$_GET["q"];   if(strlen($q) <6 && strlen($q) <> NULL)	{ echo "<p> it's true </p>";	  }      else	{    echo "<p> it's true </p>";	}

    this php/ajax code works great... Now I wana write a single "html tag" in my code in idn1.php (not double html tag)like this:

    <?php$q=$_GET["q"];   if(strlen($q) <6 && strlen($q) <> NULL)	{   echo "<p> it's true </p>";  	  }      else	{   echo "<div>";   echo "<p> it's true </p>";	}

    for (strlen($q) >=6), when I look in index.php html source code (by browser [google chorme- [inspect element])I expect view these result:

     <div><p>it's true</p>

    but i get these strange result:

     <div><p>it's true</p></div>

    I hope u got my means.I don't want print </div> tag ....I just wana see <div> tag in my html source code.what can I do to solve this problem?

    • Like 1
×
×
  • Create New...