Code: Select all
echo $comic, '<br /><a href="', $_SERVERї'PHP_SELF'], '?comic=', $comic, '&funct=2">click</a>';EDIT/UPDATE:
To output one or more strings i read it on php.net.
Moderator: General Moderators
Code: Select all
echo $comic, '<br /><a href="', $_SERVERї'PHP_SELF'], '?comic=', $comic, '&funct=2">click</a>';Code: Select all
<html><body><?php
$funct = (!empty($_GET['funct'])) ? $_GET['funct'] : 5;
$comic = (!empty($_GET['comic'])) ? $_GET['comic'] : 3;
if ($funct == 2) {
$comic = $comic - 1;
if ($comic < 1) {
$comic = 1;
}
}
echo $comic, '<br /><a href="', $_SERVER['PHP_SELF'], '?comic=', $comic, '&funct=2">click</a>';
?></body></html>twigletmac wrote: BTW, doing:is a shorter way of writing:Code: Select all
<?php $funct = (!empty($_GET['funct'])) ? $_GET['funct'] : 5; ?>and what it does is get the value of funct from the query string in the URL if it's there and if not sets it to a default value of 5 (or whatever you like).Code: Select all
<?php if (!empty($_GET['funct'])) { $funct = $_GET['funct']; } else { $funct = 5; } ?>
There has got to be some way to get this to work. I swear, no matter how long it takes me, I am going to find a way to do this. :P<html>
<body>
<table align="left" border="0" cellpadding="10" cellspacing="0">
<tr>
<td>Test1</td>
</tr>
<tr>
<td>Test2</td>
</tr>
</table>
<?php
if (!empty($_GET['funct'])) {
$funct = $_GET['funct'];
} else {
$funct = 5;
}
if (!empty($_GET['comic'])) {
$comic = $_GET['comic'];
} else {
$comic = 3;
}
if ($funct == 2) {
$comic = $comic - 1;
if ($comic < 1) {
$comic = 1;
}
// use elseif not a separate if for this
} elseif ($funct == 3) {
$comic = $comic + 1;
if ($comic > 3) {
$comic = 3;
}
} elseif ($funct == 4) {
$comic = 3;
} elseif ($funct == 5) {
$comic = 1;
}
echo '<img src="http://members.lycos.co.uk/comicsforpub ... omic.'.jpg">';
<a href="test.php?funct=2&comic=<?php echo $comic; ">back</a>
<a href="test.php?funct=3&comic=<?php echo $comic; ">forward</a>
<a href="test.php?funct=4&comic=<?php echo $comic; ">latest</a>
<a href="test.php?funct=5&comic=<?php echo $comic; ">first</a>
</body>
</html>
It works perfectly now! I'm finally done! DONE!! *murders Tripod*<html>
<?php
$latest = 3;
if (empty($funct)) {
$comic = $latest;
}
if ($funct == 2) {
$comic = $comic - 1;
if ($comic < 1) {
$comic = 1;
}
}
if ($funct == 3) {
$comic = $comic + 1;
if ($comic > 3) {
$comic = 3;
}
}
if ($funct == 4) {
$comic = 1;
}
echo '<img src="http://members.lycos.co.uk/comicsforpub ... omic.'.jpg">';
?>
<a href='test.php?funct=2&comic=<?echo ("$comic")?>'>back</a>
<a href='test.php?funct=3&comic=<?echo ("$comic")?>'>forward</a>
<a href='test.php?comic=<?echo ("$latest")?>'>latest</a>
<a href='test.php?funct=4'>first</a>
</body>
</html>