/    Sign up×
Community /Pin to ProfileBookmark

PHP & links

Hi there

I would like to learn php and I started to read some of the tutorials available on the web. It’s kind though and it is not sinking in. Would anybody have the time to explain the following to me:

How would I for instance change content of the table cells using php? Please see the mock up I have set up:

[url]http://www21.brinkster.com/lusatia/test/[/url]

Any help would be much appreciated as well as code explanation.

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@watauthorDec 09.2003 — One person wrote this code for me. Which I can understand, but the problem starts when I want to change content of for instance 3 cells in the table with one link as illustrated in my example

http://www21.brinkster.com/lusatia/test/

Would anybody show me how to do this with a code exapmle.

Thanks a bunch!


<body>

<?php

// find the name of the include file for the main section

$main = (isset($_GET['main']))? $_GET['main'] : "main";

$mainContent = "$main.php"; // This can be any file extension you want, as long as they're all the same

?>

<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">

<tr height=131>

<td colspan=2 class='top' valign='bottom'>

<?php include('top.php') ?>

</td>

</tr>

<tr>

<td class='nav' width=125 valign='top'>

<?php include('nav.php') ?>

</td>

<td class='right' valign='top'>&nbsp;

<?php include($mainContent) ?>

</td>

</tr>

</table>

</body>
Copy linkTweet thisAlerts:
@ZibingsDec 09.2003 — Working off of the code that this person made for you, we can somewhat copy what they did and use it for each section. This way, you can construct your link query-strings as need be:

[code=php]
<body>
<?php
// find the name of the include file for the main section
$main = (isset($_GET['main']))? $_GET['main'] : "main";
$nav = (isset($_GET['nav'])) ? $_GET['nav'] : "nav";
$top = (isset($_GET['top'])) ? $_GET['top'] : "top";
$mid = (isset($_GET['mid'])) ? $_GET['mid'] : "mid";

$mainContent = "$main.php"; // This can be any file extension you want, as long as they're all the same
$midBarContent = "$mid.php";
$navContent = "$nav.php";
$topContent = "$top.php";
?>
<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr height=131>
<td colspan=2 class='top' valign='bottom'>
<?php include($topContent) ?>
</td>
</tr>
<tr height=131>
<td colspan=2 class='???' valign='bottom'>
<?php include($midBarContent) ?>
</td>
</tr>
<tr>
<td class='nav' width=125 valign='top'>
<?php include($navContent) ?>
</td>
<td class='right' valign='top'>

<?php include($mainContent) ?>
</td>
</tr>
</table>
</body>
[/code]


As you can see, it's fairly simple, just construct your links as you need to:

<a href='index.php?main=blah&nav=blah&top...>

You get the idea. Hope this helped.
Copy linkTweet thisAlerts:
@watauthorDec 10.2003 — Hi Zibings

and thanks for your reply.

I am just starting out with php so some of the things are not so "given"

Do you think you could write exactly how one writes the link in php wanting to change the content of 3 cells using the names main.php, nav.php and top.php.

Sorry I am kind of d...

Additional question. Let's say I will load the pages in the respective cells, would I need to modify the general code if there is new link in the content of "nav" section that would open up yet again new content in the "main" section?

Huge thanks for your help and thanks for your patience, eh!

:-)
Copy linkTweet thisAlerts:
@watauthorDec 16.2003 — I took the advice and using the above code I constructed a webpage everything is working fine till I want to change the content of "main" with an image link which is in the "nav" cell and which I wrote like this:

<a href='index.php?main=home.php'>

<img src=home.gif">

</a>

Well, regrettably nothing is showing up just a blank white table cell ???

Any help would be much appreciated?
×

Success!

Help @wat spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...