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

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Posts

    • Seriously 1.8gig....so what. Any computer, if you are going to do serious work on, in 2026 should have a mimimum of 16gig and I would say 32-64gig is the way to go.
    • So again, you'd consider "I'm happy with my LG TV" to be a valid response to an article about PlayStation? I get the "I don't like any of their products" but how does that in any way invoke Linux? It just feels very random.
    • State of Decay 2, Blasphemous 2, and more join Xbox Free Play Days by Pulasthi Ariyasinghe The latest Free Play Days offer has just kicked off, giving Xbox players the chance to try out a new selection of games over the weekend. The offerings this time aren't as massive as last weekend, but there are still major releases for Xbox players to jump into. This includes Undead Labs' post-apocalyptic title State of Decay 2, as well as two Team17-published titles. Two of the games being offered this time are available to all Xbox players without needing any kind of Game Pass subscription. In the fully free-to-play section, you can jump into State of Decay 2. The title is both an action survival title and a community builder, letting players choose a map, set up their base, and try to keep the growing zombie threat at bay. Cooperative play is available too. Don't forget that the studio is preparing a third entry for 2027. Next, Blasphemous 2 drops in for Metroidvania and Soulslike fans, where The Penitent One returns for another adventure. The title has tough combat with multiple weapon options, deadly traps to avoid, and platforming sequences requiring a lot of patience and timing. Keep in mind though that the offer does have a 5-hour time limit attached to it. Lastly, Xbox Game Pass Ultimate, Premium, and Essential members can now try out the WWII-set first-person shooter Hell Let Loose. The multiplayer game offers 50 vs 50 combat in massive maps, with infantry, tank, and artillery options available for players. Here are the announced games and the platforms they are available to play on: Hell Let Loose (Xbox Series X|S, PC) State of Decay 2: Juggernaut Edition (Xbox Series X|S, PC) Blasphemous 2 (Xbox Series X|S, Xbox One) To easily find the titles on Xbox consoles, first head to the Store, and then in the sidebar, find the Home section. In there, open the Subscriptions tab. The Free Play Days collection will show up in this area. This week's Free Play Days promotions will end on Sunday, June 11, at 11:59 pm PT.
    • Can we not have paperless office, like we was promised in the 80's
  • Recent Achievements

    • Week One Done
      FBSPL earned a badge
      Week One Done
    • One Year In
      Jim Dugan earned a badge
      One Year In
    • One Month Later
      Tommi118 earned a badge
      One Month Later
    • One Month Later
      sjbousquet earned a badge
      One Month Later
    • Week One Done
      sjbousquet earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      486
    2. 2
      PsYcHoKiLLa
      198
    3. 3
      +Edouard
      155
    4. 4
      Steven P.
      83
    5. 5
      ATLien_0
      69
  • Tell a friend

    Love Neowin? Tell a friend!