problema switch - site dinamic

Discutii despre script-uri si coduri PHP-MySQL, precum si lucru cu XML in PHP.
Komfort
Mesaje:157

problema switch - site dinamic

index.php

Cod: Selectaţi tot

<?php
include 'style.php';
echo 
'<div style="position:absolute;top:5px;left:37%"><img src="head1.jpg"></div>
<div style="position:absolute;top:324px;left:37%;z-index: 3"><img src="head2.jpg" style="opacity:1;filter:alpha(opacity=100)" onmouseover="this.style.opacity=0.6;this.filters.alpha.opacity=50 " onmouseout="this.style.opacity=1;this.filters.alpha.opacity=100" ></div>
<div style="position:absolute;top:460px;left:37%;z-index: 3"><img src="head3.jpg"></div>';

echo ' <!--Meniu-->';

echo '<div style="position:absolute;top:330px;left:39%;z-index: 3"><font  size=4><b><a href="index.php?pagina=a">Home</a></b></font></div>
<div style="position:absolute;top:353px;left:39%;z-index: 3"><font  size=4><b><a href="index.php?pagina=b">Regulament</a></b></font></div>
<div style="position:absolute;top:376px;left:39%;z-index: 3"><font  size=4><b><a href="index.php?pagina=c">Login</a></b></font></div>
<div style="position:absolute;top:399px;left:39%;z-index: 3"><font  size=4><b><a href="index.php?pagina=d">Register</a></b></font></div>
';

if (isset($_GET['pagina'])&&$_GET['pagina']!=""){ 
$pagina=$_GET['pagina'];

include 'content.php';
}
?>
content.php

Cod: Selectaţi tot

<?php
switch($pagina){
case 'a': include 'index.php';
case 'b': include 'regulament.php';
case 'c': include 'login.php';
case 'd': include 'register.php';
}
?>
de la fiecare pagina imi da doar cazul "d"adika register.php?:(?

MarPlo Mesaje:4343
In switch (si in alte instructiuni de parcurgere a datelor), ca sa opreasca parcurgerea dupa ce a gasit valoarea potrivita, trebuie folosita instructiunea break.
Incearca asa:

Cod: Selectaţi tot


<?php
switch($pagina){
case 'a': include 'index.php'; break;
case 'b': include 'regulament.php'; break;
case 'c': include 'login.php';  break;
case 'd': include 'register.
}
?>

Komfort Mesaje:157
merge....as mai avea o problema

content.php

Cod: Selectaţi tot

<?php
switch($pagina){
case 'a': include 'index.php';break;
case 'b': include 'regulament.php';break;
case 'c': include 'login.php';break;
case 'd': include 'register.php';break;
case 'e': include 'contul_tau.php';
}
?>
login.php

Cod: Selectaţi tot

<?php
include 'cfg.php';

echo '<div style="position:absolute;top:420px;left:22%"><img src="rounded.png"></div>';

echo '<div style="position:absolute;top:560px;left:23%">

<form method=post action="index.php?pagina=e">
Manager : <input type=text name=manager ><br>
Parola: <input type=text name=parola  ><br>
 <input type=submit name=submit value=Intra></form></div>';
?>

contul_tau.php

Cod: Selectaţi tot

<?php
include 'cfg.php';

echo '<div style="position:absolute;top:420px;left:22%"><img src="rounded.png"></div>';

echo '<div style="position:absolute;top:560px;left:23%">

if(isset($_POST['submit'])){

$manager=$_POST['manager'];
$parola=$_POST['parola'];

$sql="SELECT manager,echipa,parola,stadion,echipament,locatie,bani FROM jucatori WHERE manager='$manager' AND parola='$parola'  ";
$result=mysql_query($sql);

while ($row=mysql_fetch_row($result)) { 
echo 'Manager:'.$row[0].'<br>';
echo 'Echipa:'.$row[1].'<br>';
echo 'Parola:'.$row[2].'<br>';
echo 'Stadion:'.$row[3].'<br>';
echo 'Echipament:<img src="'.$row[4].'.jpg width=64 height=54"><br>';
echo 'Locatie:'.$row[5].'<br>';
echo 'Bani:'.$row[6].'<br>';
}

mysql_close($conexiune);}
echo '</div>';
?>
dau sa ma loghez si nu apare ce e in contul_tau.php

MarPlo Mesaje:4343
Poate fiindca in "index.php" nu preiei pe 'e' cu $pagina=$_GET['pagina'];
Alta idee nu am.

Subiecte similare