Display values from db in form field

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
javiqq
Forum Newbie
Posts: 17
Joined: Wed Oct 29, 2008 9:15 am

Display values from db in form field

Post by javiqq »

I'm newbie to PHP and trying my best to learn on my own and take some courses online but currently I'm working on a website that stores information about students and their status. At the moment I have script that generates a list of students in a table and it works fine, but the list is way too long. So I thought maybe it would be efficient have the script generate the same list of students but in a TEXTAREA form field. Faculty will also need to have the ability to delete them individually or the whole list if necessary.

This is what I got so far:
<?php
$query = "SELECT re_first_name, re_last_name FROM students WHERE re_status_id_fk =3";
$result = mysql_query($query);

if($list=1)
{
while($row = mysql_fetch_assoc($result))
{
echo "<table cellspacing=3 cellpadding=0 border=0><tr><td width=70><b>Name: </b></td><td width=300>";
echo " ".$row[re_first_name]." ". $row[re_last_name]." ";
echo "</td>";


echo "</tr></table>";
}
echo "<br><br>";
}
else{
echo "The script isn't working properly, please try clicking the link again. If you continue to get this message contact your web site administrator.";
echo "<br>";
}
mysql_close();
include ('templates/footer.inc');
ob_end_flush();
exit();

?>

:arrow: :arrow: :arrow: Can anyone please help:?: :?: :?: :?:
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Display values from db in form field

Post by aceconcepts »

Instead of using a textare form element i'd use a scrollable div.

Do you know any css?
javiqq
Forum Newbie
Posts: 17
Joined: Wed Oct 29, 2008 9:15 am

Re: Display values from db in form field

Post by javiqq »

aceconcepts wrote:Instead of using a textare form element i'd use a scrollable div.

Do you know any css?
No. Someone I know that's starting out with CSS was kind enough to give me a CD with tutorials on CSS but I haven't had a chance to go over it because I'm taking tutorials online for PHP & MySQL.
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Display values from db in form field

Post by aceconcepts »

Well a scrollable div is basically an area with pre-formatted dimensions and other such settings such as scrollbar.

Code: Select all

 
<style type="text/css">
.outerDiv{ width:200px; height:100px; overflow:auto; border:1px solid #000; }
.innerDiv{ width:100%; margin:2px; }
</style>
 
<div class="outerDiv">
<div class="innerDiv">
Some content here
</div>
</div>
 
javiqq
Forum Newbie
Posts: 17
Joined: Wed Oct 29, 2008 9:15 am

Re: Display values from db in form field

Post by javiqq »

aceconcepts wrote:Well a scrollable div is basically an area with pre-formatted dimensions and other such settings such as scrollbar.

Code: Select all

 
<style type="text/css">
.outerDiv{ width:200px; height:100px; overflow:auto; border:1px solid #000; }
.innerDiv{ width:100%; margin:2px; }
</style>
 
<div class="outerDiv">
<div class="innerDiv">
Some content here
</div>
</div>
 
aceconcepts that worked great! Thank you very much for you quick response.
Post Reply