Hi All,
I am newbie to php and mysql, so need some help from you guys. I have a page under tabs menu where it will display alphabet from A-Z and it is clickable.
When user click any of the alphabet, it will display customer name started from whatever alphabet the user click. But what i want is when user click from any alphabet to another alphabet(eg: user view customer name started from 'N' and then click to 'Y'), the system will auto update the previous selection of customers name started with 'N' into the mysql database and then display the next list of customer name started with 'Y'. So that when user go back to 'N' again, he will still see his selection of customer.

Here is the code but a bit crap:

<table width='75%' border='0' align="center" cellpadding='1' cellspacing='1'>
	<tr>
    	<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">A</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">B</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">C</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">D</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">E</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">F</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">G</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">H</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">I</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">J</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">K</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">L</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">M</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">N</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">O</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">P</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">Q</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">R</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">S</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">T</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">U</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">V</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">W</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">X</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">Y</a></td>
		<td align="center" bgcolor="#CCCCCC">&nbsp;<a href="">Z</a></td>
  	</tr>
</table>
<table width="75%" border="0" align="center" cellpadding="0" cellspacing="0">
  	<tr>
    	<td colspan='3'>&nbsp;</td>
  	</tr>
	<tr>
   	  <td width="8%" align="center" bgcolor="#FF9900"><input type='checkbox' name='user' id='user' onClick=''></td>
   	  <td width="64%" align="center" bgcolor="#FF9900"><p>Full Name</p></td>
   	  <td width="28%" align="center" bgcolor="#FF9900"><p>Status</p></td>
  	</tr>
	<?
                $query = mysql_query("SELECT * FROM user_table WHERE user_fullname LIKE '".$char_sel."'";
                
	$i = 0;
	while($row_sel = mysql_fetch_array($query))
	{?>
		
	
  	<tr>
    	<td align="center" bgcolor="#CCCCCC"><input type='checkbox' name='sel_name'></td>
    	<td align="center" bgcolor="#CCCCCC">$row_sel["user_fullname"]</td>
    	<td align="center" bgcolor="#CCCCCC">$row_sel["status_user"]</td>
  	</tr>
</table>

I was stuck here and don't how to continue. Hope anyone here could help me.

Recommended Answers

All 3 Replies

Hi,

You need to use the following logic:

<a href="page.php?alp=a">A</a>
    <a href="page.php?alp=b">B</a>
    <a href="page.php?alp=c">C</a>
    <a href="page.php?alp=d">D</a>

<?
    $char_sel = $_GET['alp'];
?>

Replave page.php with the name of your page.
Use this and the code will work

Hi vicky_rawat,
Thank !
But the next step is when after user check any of the checkbox and will browse other customer name. What I want is to auto update those customers user had checked and query into the database. That mean when user checked customer started with 'N', and when he want to browse other alphabet's customer name, the system will auto update those checked customer to a temporary table in mysql DB. My problem is i can't figured out how to capture user click to another alphabet.

Hi,

you can use onblur event of a element.
So you can add this event on all checkboxes.

onblur event is fired when a element loses focus.

Hope this will help you.

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.