Jump to content

Recommended Posts

Okay, this is pretty much a newbie question but say I have the url - http://blah.com/usercp.php? - and in that page, I have a table with 2 columns - one for navigation and the other for content - like the usercp of a forum. How do you php code it such that when a link is clicked, the content on the second column changes?

 

Thanks in advance. ^_^

Link to comment
https://forums.phpfreaks.com/topic/66104-solved-same-page-on-link/
Share on other sites

The table can have another field that holds a unique value for each row i.e primary key.this primary key can be used to update the content column.every time the link is clicked,get the particular 'id' and then update the row in table that corresponds to that 'id'.

The table can have another field that holds a unique value for each row i.e primary key.this primary key can be used to update the content column.every time the link is clicked,get the particular 'id' and then update the row in table that corresponds to that 'id'.

I'm talking about the HTML table, not the database table. Unless you did get me, which in that case, I apologize. And if so, I don't even understand what you said.

sorry abt tat...

 

r all the links and content in the html table got frm database initially?

No, the links, I would put them in myself, but the contents are mostly received from the database. Sorry for the late reply.

 

It's like a forum's usercp. The left panel contains the links and the right side contains the contents where you can edit.

The left panel contains the links and the right side contains the contents where you can edit.

so tat means wen the user clicks on the link,the page gets refreshed and the content box is updated wid the new content.rite?

 

can u post the code u ve done till now?

Well I haven't done much of the code since I'm already stuck at the link part of it. But I'll give you a general look without the real links:

 

<table width='100%' border='0'>
<tr>
<td width='30%'>
<a href='_link_here'>Profile Edit</a>
<a href='_link_here'>Reports</a>
</td>
<td width='70%'>
// contents displayed upon link
</td>
</tr>
</table>

I know there aren't any php there but that's because I don't even know how to use php and get that to work. That's just an example. It's not the real thing, but if you can help me on that one, I can do the rest. I just need to know what link to put in the <a> tag and how it will be used to get the contents onto the other <td> tag.

hope tis helps,

 

<?php
$action = $_REQUEST['action'];

?>
<table width='100%' border='0'>
<tr>
<td width='30%'>
<a href='http://localhost/temp.php?&action=profile_edit' >Profile Edit</a>
<a href='http://localhost/temp.php?&action=reports' >Reports</a>
</td>
<td width='70%'>
// contents displayed upon link
<?php
if(strlen($action)!=0)
{
	if($action == "profile_edit")
	{
		//echo html code for profile
	}
	else
	if($action == "reports")
	{
		//echo html code for reports
	}
}
?>
</td>
</tr>
</table>

 

pls note the url at d href tag should be chngd accordingly...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.