retrieving

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!

Moderator: General Moderators

Post Reply
User avatar
shiranwas
Forum Commoner
Posts: 53
Joined: Fri Jul 07, 2006 10:41 pm
Location: Colombo

retrieving

Post 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'); 
} 
?>
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post 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.
User avatar
shiranwas
Forum Commoner
Posts: 53
Joined: Fri Jul 07, 2006 10:41 pm
Location: Colombo

Post by shiranwas »

hi,

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


thanx
User avatar
MarK (CZ)
Forum Contributor
Posts: 239
Joined: Tue Apr 13, 2004 12:51 am
Location: Prague (CZ) / Vienna (A)
Contact:

Post by MarK (CZ) »

Code: Select all

<input type='text' name='fieldname' value='<?php echo $fieldvalue; ?>' />
User avatar
shiranwas
Forum Commoner
Posts: 53
Joined: Fri Jul 07, 2006 10:41 pm
Location: Colombo

Post 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]
Post Reply