VogrothUnmaker Posted November 15, 2006 Author Share Posted November 15, 2006 [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 https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-125208 Share on other sites More sharing options...
VogrothUnmaker Posted November 15, 2006 Author Share Posted November 15, 2006 This is only a test post I'm having trouble posting something Link to comment https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-125227 Share on other sites More sharing options...
VogrothUnmaker Posted November 16, 2006 Author Share Posted November 16, 2006 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 https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-125299 Share on other sites More sharing options...
VogrothUnmaker Posted November 16, 2006 Author Share Posted November 16, 2006 I've been reading php books and online tutorials everywhere and none of them are giving me what I need, I know what I'm asking for can be done but I cant find it anywhere? Does anyone have [i]any[/i] ideas? Link to comment https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-125845 Share on other sites More sharing options...
The Little Guy Posted November 16, 2006 Share Posted November 16, 2006 Two things...1. Could you Re-explain what is trying to be accomplished2. Do you have a link to the problem? Link to comment https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-125851 Share on other sites More sharing options...
VogrothUnmaker Posted November 17, 2006 Author Share Posted November 17, 2006 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 https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-125938 Share on other sites More sharing options...
The Little Guy Posted November 17, 2006 Share Posted November 17, 2006 Try this:[code]<?php echo'<img alt="Comic '.$_GET['imagenum'].'" src="/comic/'.$_GET['imagenum'].'.jpg">';?>[/code] Link to comment https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-125999 Share on other sites More sharing options...
VogrothUnmaker Posted November 17, 2006 Author Share Posted November 17, 2006 Wouldnt I have to define how many Imagenumbers there are? Link to comment https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-126111 Share on other sites More sharing options...
taith Posted November 17, 2006 Share Posted November 17, 2006 heres a thought...[code]<?$comic=$_GET['comicnum'];if(empty($comic)) $comic = date(z);echo '<img alt="alt text" src="'.$comic.'.jpg">';?>[/code] Link to comment https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-126115 Share on other sites More sharing options...
VogrothUnmaker Posted November 17, 2006 Author Share Posted November 17, 2006 How would I specify the date? I dont understand. :'( I have no talent for programming. Link to comment https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-126304 Share on other sites More sharing options...
VogrothUnmaker Posted November 17, 2006 Author Share Posted November 17, 2006 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? Link to comment https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-126307 Share on other sites More sharing options...
taith Posted November 18, 2006 Share Posted November 18, 2006 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 https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-126605 Share on other sites More sharing options...
fert Posted November 18, 2006 Share Posted November 18, 2006 [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 https://forums.phpfreaks.com/topic/27159-variables-in-url/page/2/#findComment-126773 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.