Pulsanti login e registrazione

Antonio102

Utente Attivo
12 Set 2014
36
0
6
Ciao a tutti, ho questa pagina in cui sono presenti tre pulsanti: login, registrazione e guest. Ho scritto i tre script corrispondenti per effettuare login e registrazione. Vorrei che cliccando sul pulsante venisse visualizzato nella stessa pagina lo script corrispondente. Qualche consiglio su come procedere?

PHP:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
	<title>What's my MIME?</title>
	<link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/landing-page.css" rel="stylesheet">
    <link href="font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css">
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
</head>

<body>
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">What's my MIME?</a>
            </div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav navbar-right">
                    <li>
                        <a href="#">FAQ</a>
                    </li>
                    <li>
                        <a href="#">Contatti</a>
                    </li>
                    <li>
                        <a href="#">About</a>
                    </li>
                </ul>
            </div>
  </div>
   </nav>
<div class="intro-header">
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <div class="intro-message">
                        <h1>What's my MIME?</h1>
                        <h3>Tutte le info che desideri sui file</h3>
                        <hr class="intro-divider">
                        <ul class="list-inline intro-social-buttons">
                            <li>
							<form enctype="multipart/form-data" method="POST">
                                <a href="" class="btn btn-default btn-lg" value="Login">Login</a>
							</form>
                            </li>
                            <li>
                                <a href="#registrazione" class="btn btn-default btn-lg">Registrati</a>
                            </li>
                            <li>
                                <a href="#guest" class="btn btn-default btn-lg">Guest</a>
                            </li>
                        </ul>
						<?php
			if (isset($_POST['login'])==TRUE)
			require_once ('login.php');
			else
			if (isset($_POST['registrazione'])==TRUE)
			require_once ('registrazione.php');
			else
			if (isset($_POST['guest'])==TRUE)
			require_once ('guest.php');
			?>
                    </div>
                </div>
            </div>
        </div>
	</div>
<div class="banner">
        <div class="container">
            <div class="row">
                <div class="col-lg-6">
                    <h2>What's my MIME</h2>
                </div>
                <div class="col-lg-6">
                    <ul class="list-inline banner-social-buttons">
                        <li>
                            <a href="https://twitter.com/SBootstrap" class="btn btn-default btn-lg"><i class="fa fa-twitter fa-fw"></i> <span class="network-name">Twitter</span></a>
                        </li>
                        <li>
                            <a href="https://github.com/IronSummitMedia/startbootstrap" class="btn btn-default btn-lg"><i class="fa fa-github fa-fw"></i> <span class="network-name">Github</span></a>
                        </li>
                        <li>
                            <a href="#" class="btn btn-default btn-lg"><i class="fa fa-linkedin fa-fw"></i> <span class="network-name">Linkedin</span></a>
                        </li>
                    </ul>
                </div>
            </div>

        </div>
	</div>
<footer>
        <div class="container">
            <div class="row">
                <div class="col-lg-12">
                    <ul class="list-inline">
                        <li>
                            <a href="#home">Home</a>
                        </li>
                        <li class="footer-menu-divider">&sdot;</li>
                        <li>
                            <a href="#about">FAQ</a>
                        </li>
                        <li class="footer-menu-divider">&sdot;</li>
                        <li>
                            <a href="#services">Contatti</a>
                        </li>
                        <li class="footer-menu-divider">&sdot;</li>
                        <li>
                            <a href="#contact">About</a>
                        </li>
                    </ul>
                    <p class="copyright text-muted small">Copyright &copy; Antonio Deriu 2014. All Rights Reserved</p>
                </div>
            </div>
        </div>
    </footer>
    <script src="js/jquery-1.11.0.js"></script>
    <script src="js/bootstrap.min.js"></script>
</body>
</html>
 
Ciao, puoi provare cosi
PHP:
<?php
if (isset($_GET['login'])) {
    echo "script login";
} else if (isset($_GET['register'])) {
    echo "script register";
}
?>
<a href="?login" value="Login">Login</a>
<a href="?register" >Registrati</a>
 
Ciao, puoi provare cosi

provato ma non va, una volta che apro index.php viene visualizzato immediatamente "script login" subito sotto i pulsanti. Ti posto il form e il codice php

HTML:
<form enctype="multipart/form-data" method="GET">
                                <a href="?login" class="btn btn-default btn-lg">Login</a>
							
                            </li>
                            <li>
                                <a href="?register" class="btn btn-default btn-lg">Registrati</a>
                            </li>
                            <li>
                                <a href="?guest" class="btn btn-default btn-lg">Guest</a>
                            </li>
							</form>

PHP:
<?php
					if (isset($_GET['login'])) {
						echo "script login.php";
						} else if (isset($_GET['register'])) {
						echo "script register.php";
						}
						else if (isset($_GET['guest'])) {
						echo "script guest.php";
						}						
					?>
 
Togli gli isset.
E lo script devi inserirlo con include("nomescrip.php"); non con l'echo.

Inviato con Tapatalk Free da Android
 

Discussioni simili