Jump to content

Variables in URL


VogrothUnmaker

Recommended Posts

[quote author=The Little Guy link=topic=114878.msg467647#msg467647 date=1163473977]
Maybe it will work this way
[code]<?php
$comic = $_GET['comicnum'];
switch($comic){
case 1:
    $image = '<img alt="alt text" src="Imagename1.jpg">';
break;
case 2:
    $image = '<img alt="alt text" src="Imagename2.jpg">';
break;
case 3:
    $image = '<img alt="alt text" src="Imagename3.jpg">';
break;
}
echo $image;
?>[/code]
[/quote]
[size=8pt][color=teal]This codes all faulty too... it prints out the code itself replacing the image tag with the images but it shows them all along with the rest of the code.[/color][/size]
Link to comment
Share on other sites

Code I want in Javascript form lacks variable appended to url:
[code]var imagenum = 5
var finalnum = 5
function wayBack()
{ imagenum=1
drawComic()
}
function nxtback()
{ if(imagenum > 1)
{ imagenum--
drawComic()
}
}
function nxtfwd()
{ if(imagenum < finalnum)
{ imagenum++
drawComic()
}
}

function wayFwd()
{ imagenum = finalnum
drawComic()
}
function drawComic()
{ document.comic.src="comic/"+imagenum+".jpg"
}[/code]
Website code came from view sourcecode: [url=http://69.248.112.19/]http://69.248.112.19/[/url]
Link to comment
Share on other sites

Look at this website [url=http://69.248.112.19/]http://69.248.112.19/[/url] I am trying to host a webcomic and I want something like that. My problem is I do not know how to code it in PHP. I need PHP because I want to display the comic number in the url and you can not do that with javascript. I do not know how else to explain it and I cant link you to my website because my server is not connected to the internet (i am having port fowarding issues).
Link to comment
Share on other sites

the date(z) is from 0-365 (including loop years)
just name your images one of them numbers, and on that day, i'll show...

then you just

[code]
<?
$comic=$_GET['comicnum'];
if(empty($comic)) $comic = date(z);

echo '<img alt="alt text" src="'.$comic.'.jpg">';

$pd=$comic -1;
$nd=$comic +1;
echo '<a href="?comic='.$pd.'">Previous</a> <a href="?comic='.$nd.'">Next</a>';
?>
[/code]
Link to comment
Share on other sites

[quote author=VogrothUnmaker link=topic=114878.msg469731#msg469731 date=1163793762]
I think I found what Im looking for in a website but when I open the source code I cant see any of the php script. I am using firefox, is there a plugin i can use to view php script?
[/quote]
PHP is server side the only way to view the PHP code would be to download the file with FTP.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.