/    Sign up×
Community /Pin to ProfileBookmark

PHP Novice – Assistance required

Hope someone can assist me but please be aware I no nothing about PHP but understand that it can quite easily perform the function I hope to acheive.

I would like to change the contents of the contents box (Largest box on the page) when users click on the menu on the right.

Any help would be much appreciated.

Many thanks

Simon ?

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@gebezisJul 07.2005 — This is achieved with frames (frameset). It is HTML - not PHP...
Copy linkTweet thisAlerts:
@theuedimasterJul 07.2005 — The best way is by making those links submit buttons. First of all you'll only need one file, and that should be a .php file, not a .htm file. For example, change
[code=php]
<li class="services"><a href="http://www.fsinternet.co.uk/pioneer/booking_forms.htm" class="toplevel">Booking Forms</a></li>
[/code]

to this
[code=php]
<li class="services">
<form method="POST"action="http://www.fsinternet.co.uk/pioneer/pioneer.php?func=1">
<input type="submit" name="submit" value="Booking Forms">
<input type="hidden" name="title" value="This is the title">
<input type="hidden" name="text" value="This is some text"></form>
</a></li>
[/code]

At the top of your page (before the <html> tag) put this:
[code=php]
<?
if(isset($func) && $func == 1) {
$title=$_POST['title'];
$text=$_POST['text'];
}
?>
[/code]

and then, assuming this is the text box where the text is supposed to show up, put this:
[code=php]
<div id="main">
<? echo($title); ?><br><br>
<? echo($text); ?>
</div>
[/code]


These are just some basics. Good Luck!

(P.S if you want to know how to style a submit button, you can use the tips I made here:

https://webdeveloper.com/forum/showthread.php?t=72084)
Copy linkTweet thisAlerts:
@SimonBahrauthorJul 08.2005 — Thanks for that. If I create another page called booking_forms.htm will this pull this page through.

I understand there is a function called includes which can perform this task.

Thanks for your help.

Si ?
Copy linkTweet thisAlerts:
@bathurst_guyJul 08.2005 — Yeah I have this on my site, makes updating easy.

I have a top page, Save this page as doc (with no extention)(youll need to make changes to this code obviously):
[CODE]
<?php
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">'."n";
echo '<html>'."n";
echo '<head>'."n";
echo '<title>'."n";
?>
[/CODE]

Then make another page called header:
[CODE]
<?php
echo '</title>'."n";
echo '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="http://www.fsinternet.co.uk/pioneer/resources/pstyle.css" rel="stylesheet" type="text/css" />'."n";
echo '<link href="http://www.fsinternet.co.uk/pioneer/resources/playout.css" rel="stylesheet" type="text/css" />'."n";
echo '</head>'."n";
echo '<body>'."n";
echo '<div id="center">'."n";
echo '<div id="frame">'."n";
echo '<div id="header">'."n";
echo '<div id="lino"><a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm"><img src="http://www.fsinternet.co.uk/pioneer/images/lino.jpg" border="0" alt="Pioneer Administration Centre"></a></div>'."n";
echo '<div id="title"><a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm"><img src="http://www.fsinternet.co.uk/pioneer/images/title.gif" border="0" alt="Pioneer Administration Centre"></a></div>'."n";
echo '</div>'."n";
echo '<div id="mainnav">'."n";
echo '</div>'."n"'
echo '<div id="piclogo">'."n";
echo '</div>'."n";
echo '<div id="main">'."n";
?>
[/CODE]

Then another file called footer:
[CODE]
echo '<div id="mainright">'."n";
echo '<h2>Administration</h2>'."n";
echo '<div class="admin">'."n";
echo '<ul class="adminlist">'."n";
echo '<li class="servicesTop"><a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm" class="toplevel">Home</a></li>'."n";
echo '<li class="services"><a href="http://www.fsinternet.co.uk/pioneer/booking_forms.htm" class="toplevel">Booking Forms</a></li>'."n";
echo '<li class="services"><a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm" class="toplevel">Public Literature</a></li>'."n";
echo '<li class="services"><a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm" class="toplevel">Events Calendar</a></li>'."n";
echo '<li class="services"><a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm" class="toplevel">Contacts</a></li>'."n";
echo '<li class="services"><a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm" class="toplevel">Links</a></li>'."n";
echo '</ul>'."n";
echo '</div>'."n";
echo '<h2>News</h2>'."n";
echo '<div class="admin">'."n";
echo '<ul class="adminlist">'."n";
echo '<li class="servicesTop"><a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm" class="toplevel">Latest News</a></li>'."n";
echo '</ul>'."n";
echo '</div>'."n";
echo '</div>'."n";
echo '<div id="hlf">'."n";
echo '<a href="http://www.hlf.org.uk/English/" target="_blank" class="hlf"><img src="http://www.fsinternet.co.uk/pioneer/images/hlf.jpg" border="0" alt="Heritage Lottery Fund"></a>'."n";
echo '</div>'."n";
echo '<div id="footerleft"><p class="foot">&nbsp;</p>'."n";
echo '</div>'."n";
echo '<div id="footerright"><a href="http://www.fsinternet.co.uk/index.htm" class="foot">Hosting</a> and <a href="http://www.fsinternet.co.uk/index.htm" class="foot">web design</a> provided free by <a href="http://www.fsinternet.co.uk/index.htm" class="foot">fsinternet.co.uk</a>'."n";
echo '</div>'."n";
echo '</div>'."n";
echo '</div>'."n";
echo '</body>'."n";
echo '</html>'."n";
?>
[/CODE]

And finally index.php:
[code=php]
<? php include('doc'); ?>
Pioneer Administration Centre
<?php include('header'); ?>

<h1>Welcome to the Pioneer Administration Centre,</h1>
<p>from here you can access <a href="http://www.fsinternet.co.uk/pioneer/booking_forms.htm" class="middle">Booking Forms</a>, <a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm" class="middle">Public Literature</a>, the <a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm" class="middle">Events Calendar</a>, <a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm" class="middle">Contacts</a> and associated <a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm" class="middle">Links</a>.</p>

<p>Designed to support the Pioneer Sailing Trust this website provides a centralised, web-based administration tool which will grow with the needs of the Trust.</p>
<p>Please visit on a regular basis to see the latest <a href="http://www.fsinternet.co.uk/pioneer/pioneer.htm" class="middle">News</a>, updates and improvements.</p>
<p class="mainfoot">If you have any suggestions for improvements to this website please email the <a href="mailto:[email protected]" class="webmaster">Webmaster</a></p>
</div>

<?php include('footer'); ?>
[/code]

Well there's your website LOL

Then you just have to change the title and text for each page but leave the includes. Then if you were to have to modify the menu you can do it on the footer page and it is automatically updated on every page that includes it.

?
Copy linkTweet thisAlerts:
@SpectreReturnsJul 08.2005 — This is achieved with frames (frameset). It is HTML - not PHP...[/QUOTE]

Frames == teh devil
Copy linkTweet thisAlerts:
@SimonBahrauthorJul 08.2005 — Thanks bathurst_guy,

I've done some further research on this topic and the results correspond with your code, accept why do you use echo? The other examples I've looked at dont use this so I wondered why.

Cheers Si.
Copy linkTweet thisAlerts:
@theuedimasterJul 09.2005 — You need to use echo to print out html code when using php. You can understand it a lot more by reading the php section of http://www.w3schools.com
Copy linkTweet thisAlerts:
@gameguy43Jul 09.2005 — not true, php is embedded in html, so you can do all kinds of fun things. when you end your php stuff (with "?>") you can have html. for example, all this stuff works:
[code=php]
<?php echo("he");
?>
llo wo
<?php
$str = "rld!";
echo $str;
?>
[/code]


this would just output hello world! php is very versatile, and when you find yourself trying to accomplish a complex task, you often find that there is already a php function that does it for you. good luck, may the force be with you?
Copy linkTweet thisAlerts:
@bathurst_guyJul 09.2005 — If you would like to remove echo on the include files then just make sure that you also remove <?php and ?> so that it is recognised as html. I just did it that way cause I ran a find an replace in Dreamweaver to replace the end of every line with '."n"; and the start of every line with echo '

After doing it i realised that I didn't need to ?
×

Success!

Help @SimonBahr 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.8,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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