Page 1 of 1

retrieving

Posted: Thu Aug 03, 2006 7:42 am
by shiranwas
this is what i want

//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'

Code: Select all

<?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'); 
} 
?>

Posted: Thu Aug 03, 2006 7:57 am
by MarK (CZ)
I don't see where the problem is?

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.

Posted: Thu Aug 03, 2006 8:03 am
by shiranwas
hi,

my coding is working, but i do not know how to show retrieved data
in existing html controls(text box)


thanx

Posted: Thu Aug 03, 2006 9:32 am
by MarK (CZ)

Code: Select all

<input type='text' name='fieldname' value='<?php echo $fieldvalue; ?>' />

Posted: Thu Aug 03, 2006 10:54 pm
by shiranwas
feyd | Please use

Code: Select all

,

Code: Select all

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>
this is my PHP[/syntax]

Code: Select all

<?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'); 
} 
?>

PLEASE HELP ME


SHIRAN


feyd | Please use

Code: Select all

,

Code: Select all

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]