• 0

Help with main page: want some content to stay the same


Question

Assalamalaikum (peace be unto you) to all the Muslims,

and a Hi to everyone else,

I'm currently doing a project for a course at my university, we are told to create a simple registration system using PHP and MySQL. I've already created the logon page and it works well. I'm currently working on the Main Page which the user is shown after a successful login attempt.

I'm a beginner at PHP and MySQL so any advice as to how to improve my code is appreciated as well :)

Now on to the question, on the Main Page, I have several buttons positioned in a certain way and a content area below them. What I want to do is to change the content area depending on the button pressed. But once a button is pressed, the old content from the content area is removed and the new content is displayed. I don't want to change the buttons position,etc... or the title, etc... just the content area every time a button is pressed.

Here is my source code:

<html><title>Main Page</title>

<style type="text/css">
div#main
{
	text-align: left;
	font-size: 200%;
}

div#user
{
	text-align: left;
	font-size: 100%;
}
</style>

</html>
<?php
$user= $_POST["user"];
$pwd = $_POST["pwd"];
$database="wp_project";
$connect = mysql_connect('localhost',$user,$pwd);
$thedatabase=mysql_select_db($database,$connect) or die( "Unable to select database");

$get_name = mysql_query("SELECT concat(p_first,' ',p_last) AS Name FROM people") or die(mysql_error());
while($info = mysql_fetch_array($get_name))
{
$user_name=$info['Name'];
}


if(!$connect)
{
	echo "MySQL connection failed!";
	mysql_error();
	exit;
}
else
{
?>	
	<html><div id="main"></html><?php
	Print "Main Page<br/>";?>
	<html></div>

	<html><div id="user"></html><?php
	Print "User: $user_name";?>
	<html></div><HR>

	<input type='submit' name="allbooking" value="View Booking(s)"/>
	<input type='submit' name="newbooking" value="New Booking"/>
	<input type='submit' name="venuecheck" value="Venue Availability"/>
	<input type='submit' name="history" value="User History"/>
	<input type ="submit" name="logoutbutton" value="Logout"/><br/>
	<HR>

	</html></html>
	<?php
	mysql_close();
};
?>

Screenshot is attached. Any help is much appreciated.

Thanks a lot.

post-131379-0-18378700-1324154176_thumb.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.