Page 1 of 1

Display values from db in form field

Posted: Wed Oct 29, 2008 9:26 am
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:?: :?: :?: :?:

Re: Display values from db in form field

Posted: Wed Oct 29, 2008 10:41 am
by aceconcepts
Instead of using a textare form element i'd use a scrollable div.

Do you know any css?

Re: Display values from db in form field

Posted: Wed Oct 29, 2008 12:02 pm
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.

Re: Display values from db in form field

Posted: Wed Oct 29, 2008 12:18 pm
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>
 

Re: Display values from db in form field

Posted: Wed Oct 29, 2008 2:40 pm
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.