echo isset($sida) ? $sida : 'Inget värde angivet för sida';
eller?
------------------
Before you criticize someone, walk a mile in his shoes. That way, if he gets angry, he'll be a mile away - and barefoot.
[Redigerat av spango den 14 jan 2002]
3 svar · 210 visningar · startad av muskot
Om jag vill att en viss text visas när man kommer till index.php, men bytas ut om man skriver t ex index.php?sida=1 elller index.php?sida=2, hur gör jag då?
Om jag gör ungefär så här visas ju texten på index.php?sida=1 elller index.php?sida=2 direkt under den text som finns på index.php:
<?php
if ($HTTP_GET_VARS['sida']=='1'){
echo 'sida 1';
}
if ($HTTP_GET_VARS['sida']=='2'){
echo 'sida 2';
}
?>
Känner att jag har lite svårt att förklara vad jag menar, men jag hoppas att ni förstår ändå...
echo isset($sida) ? $sida : 'Inget värde angivet för sida';
eller?
------------------
Before you criticize someone, walk a mile in his shoes. That way, if he gets angry, he'll be a mile away - and barefoot.
[Redigerat av spango den 14 jan 2002]
Kanske
if ($HTTP_GET_VARS['sida']=='1'){
echo 'sida 1';
} elseif($HTTP_GET_VARS['sida']=='2'){
echo 'sida 2';
} else {
echo 'Text som visas när $sida är tom';
}
?
------------------
Luftmadrass!
[Redigerat av Viking den 14 jan 2002]