Php 4 klappt nicht richtig

Alles, was PHP betrifft, kann hier besprochen werden.

Php 4 klappt nicht richtig

Postby Hallomann » 09. April 2006 18:59

Guten Abend

Ich habe ein Problem mit Xampp und PHP4
ich benutze in meinen Seiten für die Navigation einen
Switch-Befehl:
Code: Select all
switch($action){
case "profil":
include("profil.php");
break;
}


Und es hatte bis vor kurzem alles geklappt.
Ich habe dann auf eine neue Version von Xampp geupdatet und jetzt klappt dies nicht mehr.Alles andere ja.
Habe dann die HP mal wo anders hochgeladen und da funktioniert es wunderbar.

Ich hoffe ihr könnt mir helfen und sagen wie ich dieses Problem fixen kann!

MfG
Hallomann
Hallomann
 
Posts: 5
Joined: 09. April 2006 18:48

Postby Wiedmann » 09. April 2006 19:26

Wo wird "$action" definiert (ein Wert zugewiesen)?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Hallomann » 09. April 2006 19:49

mache das in form eines Links:

<a href="index.php?action=profil">Show Profil</a>

wie gesagt hat bis vor dem update immer mit xampp geklappt
mache das so ca 1 1/2 Jahre.
Woran könnte das liegen?
Hallomann
 
Posts: 5
Joined: 09. April 2006 18:48

Postby Wiedmann » 09. April 2006 20:06

<a href="index.php?action=profil">Show Profil</a>

In dem Fall nennt sich die Variable "$_GET['action']".

mache das so ca 1 1/2 Jahre.

Wenn man überlegt, dass dein Verfahren sein 4 Jahren nicht mehr so im PHP-Manual beschrieben wird... Du solltest deine Doku aktualisieren.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Hallomann » 09. April 2006 20:40

Mh damit geht es auch nicht :(

Kann ja sein mit meiner Doku aber hat bis jetzt auf jedem Sever problemlos geklappt :D

Ich kapier das einfach net
Hallomann
 
Posts: 5
Joined: 09. April 2006 18:48

Postby Wiedmann » 09. April 2006 21:21

Dann zeig doch mal ein komplettes kurzes(!) Script das nicht geht.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby Hallomann » 09. April 2006 21:31

Code: Select all
<html>
<body>
<table width="571" border="1" cellpadding="0" cellspacing="0">
  <tr>
    <td width="127"><a href="index.php?action=test">Test</a> </td>
    <td width="434">
<?
$act = $_GET['action'];
switch($act){
case "test":
include("test.php");
break;
}?></td>
  </tr>
</table>
</body>
</html>
Hallomann
 
Posts: 5
Joined: 09. April 2006 18:48

Postby Wiedmann » 09. April 2006 23:30

Also von der Sache her sollte dieses Script so tun... Lass doch mal zusätzlich das GET-Array mit ausgeben:
Code: Select all
<html>
<body>
    <table width="571" border="1" cellpadding="0" cellspacing="0">
    <tr>
        <td width="127"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?action=test">Test</a></td>
        <td width="434">
        <?php
            if (isset($_GET['action'])) {
                switch ($_GET['action']) {
                case 'test':
//                  include 'test.php';
                    echo 'include \'test.php\';';
                    break;
                }
            }
        ?>
        </td>
    </tr>
    </table>
    <br>
    <pre><?php echo var_dump($_GET); ?></pre>
</body>
</html>


BTW:
Die Demoseiten vom XAMPP gehen noch? Oder andere PHP-Scripte wie ein kurzes phpinfo()?
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby gfaust » 10. April 2006 07:07

Hallo,

in Deinem Script benutzt Du "Short-Tags" (<? ?>) die unter Umständen gar nicht aktiviert sind!
Benutze lieber die ausführlichen Tags (<?php ?>) um Deinen Script-Bereich zu markieren, oder stelle die Short-Tags an.

Guido

P.S.: Wiedmann benutzt übrigens auch keine Short-Tags ;-)
gfaust
 
Posts: 41
Joined: 06. December 2005 18:31

Postby Hallomann » 10. April 2006 09:24

Danke habe jetzt mal dein Script (Wiedmann) genommen.
Da sind ja auch die ausführlichen Tags drin und jetzt klappt es :)

Vielen Dank

MfG
Hallomann
Hallomann
 
Posts: 5
Joined: 09. April 2006 18:48


Return to PHP

Who is online

Users browsing this forum: No registered users and 12 guests