Jump to content

[SOLVED] Same page on link


Ken2k7

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.

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...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.