Hello,
not quite sure under what category to place this in so I'll post it here..
Hello,
I found a dynamic page tutorial from youtube and for most part it works.
Problem area: css is lost when the data entry form returns back from processing the user information.
What I have:
Index.php -> Menu, Css information.
/template/contact.php - > user entry form
/inc/formprocessing.php -> handles the user entry from and returns back to contact.php
research:
the CSS link is located in index.php. When contact.php calls the formprocessing.php to do its thing and returns back to the calling page(contact.php) the CSS is lost. Basically the contact.php no longer has a link to the CSS when fromprocessing.php returns back to contact.php.
How can I fix this small problem?
<html>
<head>
<title> Website </title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div id="header"> <h1> Website </h1> </div>
<div id="menu">
<a href="index.php"> Home </a>
<a href="index.php?p=aboutus"> About us </a>
<a href="index.php?p=contactus"> Contact us </a>
<a href="index.php?p=news"> News </a>
</div>
<div id="content" >
<?php
$pages_dir = 'template';
if (!empty($_GET['p']))
{ $pages = scandir($pages_dir, 0);
unset($pages[0], $pages[1]);
$p = $_GET['p'];
if(in_array($p . '.inc.php', $pages))
{ include ($pages_dir . '/' . $p . '.inc.php'); }
else
{ echo 'Sorry, page not found'; }
}
else
{ include ($pages_dir.'/home.inc.php'); }
?>
</div>
</body>
</html>
<?php
if($_POST['btl_save'])
{ echo $testVar;}
?>
<h3> Contact us </h3>
<form action="inc/formprocessing.php" method="post">
<div class="testcss">
First name: <input type="text" name="fname" /> <br/>
Last name: <input type="text" name="lname" /> <br/>
<input type="submit" name=btl_save">
</div>
<?php
$testVar = 'test form processing.php';
include('../template/contactus.inc.php');
?>