PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
//here i want to show the values i got from the query ,in the HTML page ('complaintrdata.htm') where it has 2 existing text boxes one named as 'subject ' and other named as 'personname'
<?php
$jobno=$_POST['txtJobNo'];
include('Conn.php');
$sql="select * from complains where jobno='$jobno'";
$result=mysql_query($sql) or die ("error");
if (!$result)
{
die ("Could not query the database: <br />". mysql_error());
}
$row = mysql_fetch_array($result, MYSQL_ASSOC) ;
//here i want to show the values i got from the query ,in the HTML page ('complaintrdata.htm') where it has 2 existing text boxes one named as 'subject ' and other named as 'personname'
include('complaintrdata.htm');
}
?>
BTW, you should escape any user input before putting it into a SQL query. Second, using * instead of columns isn't mostly very efficient because you may be (and probably are) asking the db for more data than you need. It's also imho better for readability since you don't have to see the db to find out what columns you're getting.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hi,
it did not work when i put in php page,
what i really want is the value i got form the query, to show in a html page with existing text control called txtLastName
this is my html document
[syntax="html"]<html>
<body>
<form method="POST" action="complaintrdata.php">
<input name="txtJobno" type="text" style="color: #000; background: #EFEFEF; border: 2px solid #781351">
<!-- I WANT THE VALUE TO BE APPEARED HERE-->
<input name="txtLastName" type="text" style="color: #000; background: #EFEFEF; border: 2px solid #781351">
<input type="submit" name="cmdOK" value="OK" >
</form>
</body>
</html>
<?php
$jobno=$_POST['txtJobNo'];
include('Conn.php');
$sql="select * from complains where jobno='$jobno'";
$result=mysql_query($sql) or die ("error");
if (!$result)
{
die ("Could not query the database: <br />". mysql_error());
}
$row = mysql_fetch_array($result, MYSQL_ASSOC) ;
//here i want to show the values i got from the query ,in the HTML page ('complaintrdata.htm') where it has 2 existing text boxes one named as 'subject ' and other named as 'personname'
include('complaintrdata.htm');
}
?>
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]