Image

Imagedevolve_absolve wrote in Imagephp 😊thoughtful

Listens: Spineshank - Asthmatic

Quick Fix? :P

EDIT: Solved (thanks Imagebrindy =P )


Hey there people. I'm curious about something, namely the use of id to change pages. I'm testing it with images to start, before contemplating a MySQL/PHP integrationg for a website, but I do have a problem.

when I load the page tester.php without the addition of ?id=0 I get this returned to me

Notice: Undefined index: id in c:\program files\easyphp1-7\www\tester.php on line 3

Now, I'm wondering how to get around this. Is there something I can place in the code to verify the inputs, and if there is none, rather than print out an error message and screw things up, it instead defaults to 0?

Also if anyone has any streamlining tips, then they would be appreciated.




< ?

$id = $_GET['id'];
$newid = ($id + 1);

if ($id == "0") { $image = "136064.jpg"; }
elseif ($id == "1") { $image = "iowa.jpg"; }
elseif ($id == "2") { $image = "nachtwey.jpg"; }

echo $id;
? >

< img src="< ? echo "$image"; ? >" >

< a href="tester.php?id=< ? echo "$newid"; ? >" >Next< /a >