1

Based on the title above, my problem is related with iframe and php connection. Example: When the user click the login button after inserting their username and password on the login form given. The iframe below, should load new field name responsiblity that consist data from database that related with username entered before.But the problem is my iframe don't shown any field but only return php code "$row[1]"; } ?> ".

Below is mycode:

Login.Php

<form id="ex" method=post action=testconn.php target="ifram1">
      <table>
          <tr><th align="center">Username</th><td><input type="text" name="mynam" id="nam" required></td></tr>
          <tr><th align="center">Password</th><td><input type="password" name="pass" id="mypass" required></td></tr>
      </table>
      <input type="submit" value="testing">
</form>

<br><br><iframe name="ifram1"  width="100%" height="500"></iframe>

testconn.php

<?
require "conpiq.php";
$link = mysqli_connect($host,$user,$pass,$db);

$pname=@$_POST["nam"];
$ppass=@$_POST["mypass"];


$q="select * from testing where user_name LIKE '$pname' AND password LIKE '$ppass'";
$result=mysqli_query($link,$q);

      while($row=mysqli_fetch_array($result))
       {
            echo"<option value='$row[1]'>$row[1]</option>";
        }
 ?>
 <br>
 <button onclick="window.top.location.href='http://testpage.html'">Next</button>

conpiq.php

<? 
$host="localhost";
$user="root";
$pass="12345";
$db="testing";
?>

I want to know what the problem with my "testconn.php" and why it doesn't return select field and show half of the code instead?

Nexz
  • 111
  • 1
  • 10

0 Answers0