good day.!

I am currently developing an enrolment system which will be on february 12-13 the deadline. In the middle of development, the client wants that on every link the pop-up info to be display on that link will be from the mysql database. Assuming that i already have a connection to mysql and i have a table could linkinfo. The flow should like like this:

First Year
Math Matranillo Cawite
Science Nancy Divincio

Second Year
Math Doromal Tancio
Science Davis Leo

When the client clink on the first year link, the the Math and Science Info with the corresponding teachers will be displayed which is from the database. And when the user click second year, the popinfo of first year will disappear then it will show the popup info of second year. I have a code of this situation from a forum that reply to my thread last month but its not from the database. Here is the code:

<div class='year'>
<a href='#' onfocus="showIt('firstyear');" onclick="showIt('firstyear');"  onblur="hideIt('firstyear');" taborder=1>First Year</a> <!-- onfocus onclick allows for keyboard tab as well as mouseclick-->
<div id='firstyear' style='visibility:hidden'> <!-- initially invisible -->
<input type='checkbox' value='filipino'>filipino<br>
<input type='checkbox' value='math'>math<br>
<input type='checkbox' value='sci'>science<br>
</div></div>
<div class='year'>
<a href='#' onfocus="showIt('secondyear');" onclick="showIt('secondyear');"  onblur="hideIt('secondyear');" taborder=2>second Year</a> 
<div id='secondyear' style='visibility:hidden'> 
<input type='checkbox' value='filipino'>2filipino<br>
<input type='checkbox' value='math'>2math<br>
<input type='checkbox' value='sci'>2science<br>
</div></div>

pls help me. Im not really a good php programmer. In fact i am eager to learn from the experts. I dont have any reliable source about this problem. My expertise is vb6.

I would say a big thank you and God bless for helping me on this.

Learn database functions for whatever db server your client uses (MySQL, whatever). A tutorial on SQL statements and the php manual will help you with this.

Learn database functions for whatever db server your client uses (MySQL, whatever). A tutorial on SQL statements and the php manual will help you with this.

thank you for your advise.!!ill try to loop on the table of my mysql database. and maybe i could insert the code on the syntax ive provided on my thread.

Pls give a sample or hint.!!

Sure here's a suggestion. Find a host with MySQL (or ask your host to install it for you) and create a database for your site. Then create a table and call it years. In this table create three columns: a name column, a year column, and a code column (all of them can be varchar). The name column should contain the names, the year column the year (first, second, third, etc.), and the code column the abbreviation (sci, etc).
Then use this code:

<div class='year'>
<a href='#' onfocus="showIt('firstyear');" onclick="showIt('firstyear');"  onblur="hideIt('firstyear');" taborder=1>First Year</a> <!-- onfocus onclick allows for keyboard tab as well as mouseclick-->
<div id='firstyear' style='visibility:hidden'> <!-- initially invisible -->
<?php
$con = mysql_connect("HOST", "USERNAME", "PASSWORD") or die("Cannot connect to MySQL");
mysql_select_db("DB", $con);
$result = mysql_query("SELECT * FROM years WHERE year='first'");
while($row=mysql_fetch_array($result)
 echo "<input type='checkbox' value='".$row['code']."'>".$row['name']."<br>\n";
}
?>
</div></div>
<div class='year'>
<a href='#' onfocus="showIt('secondyear');" onclick="showIt('secondyear');"  onblur="hideIt('secondyear');" taborder=2>second Year</a> 
<div id='secondyear' style='visibility:hidden'> 
<?php
$result = mysql_query("SELECT * FROM years WHERE year='second'");
while($row=mysql_fetch_array($result)
 echo "<input type='checkbox' value='".$row['code']."'>".$row['name']."<br>\n";
}
?>
</div></div>

Sure here's a suggestion. Find a host with MySQL (or ask your host to install it for you) and create a database for your site. Then create a table and call it years. In this table create three columns: a name column, a year column, and a code column (all of them can be varchar). The name column should contain the names, the year column the year (first, second, third, etc.), and the code column the abbreviation (sci, etc).
Then use this code:

<div class='year'>
<a href='#' onfocus="showIt('firstyear');" onclick="showIt('firstyear');"  onblur="hideIt('firstyear');" taborder=1>First Year</a> <!-- onfocus onclick allows for keyboard tab as well as mouseclick-->
<div id='firstyear' style='visibility:hidden'> <!-- initially invisible -->
<?php
$con = mysql_connect("HOST", "USERNAME", "PASSWORD") or die("Cannot connect to MySQL");
mysql_select_db("DB", $con);
$result = mysql_query("SELECT * FROM years WHERE year='first'");
while($row=mysql_fetch_array($result)
 echo "<input type='checkbox' value='".$row['code']."'>".$row['name']."<br>\n";
}
?>
</div></div>
<div class='year'>
<a href='#' onfocus="showIt('secondyear');" onclick="showIt('secondyear');"  onblur="hideIt('secondyear');" taborder=2>second Year</a> 
<div id='secondyear' style='visibility:hidden'> 
<?php
$result = mysql_query("SELECT * FROM years WHERE year='second'");
while($row=mysql_fetch_array($result)
 echo "<input type='checkbox' value='".$row['code']."'>".$row['name']."<br>\n";
}
?>
</div></div>

very very much thank you for helping mt problem. It helped me so much.God bless.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.