DEVILofDARKNESS Posted February 24, 2009 Share Posted February 24, 2009 I think the problem is in the $_GET (again)... the code doesn't work fine, it always give me the page where $type = "poem". for the $_GET, the page link is: 4ade.uuuq.com/gedichten/test/testgedicht.php?poem_id=1&type=poem <?php /* DATABASE SETTINGS */ $test = (int)$_GET["poem_id"]; $type = $_GET["type"]; if(isset($test)) { $query= "SELECT p.*, u.*, c.* FROM poems p INNER JOIN users u ON u.user_id = p.user_id INNER JOIN categories c ON c.category_id = p.category_id WHERE p.poem_id = '$test'"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) : if($type="poem") { $title = $row['poem_name']; $text = $row['poem_text']; }elseif($type="info") { $title = "INFO"; $text = "This is where the info should come"; } else { echo "<script type='text/Javascript'> alert('This page doesn't exist, or is under construction, you will now be redirected to the main page.'); </script>"; header('location:../../index.html'); }; ?> <html dir="ltr"> <head> <title><?php echo $title; ?></title> <link href="../../standard.css" type="text/css" rel="stylesheet" /> <link href='liefde.css' type='text/css' rel="stylesheet" /> </head> <body> <table class="look" height="100%" width="100%" border="1"> <tbody> <tr> <td width="10%" height="100%"><iframe class="frames" src="../../functieknoppen/functieknoppengedicht.php?poem_id=<?php echo $_GET['poem_id']; ?>" frameborder="0" width="100%" height="100%" scrolling="no"></iframe> </td> <td><center> <?php echo $text; ?> </center></td> </tr> </tbody> </table> </body> </html> <?php endwhile; } ?> Link to comment https://forums.phpfreaks.com/topic/146681-solved-_get-problem-3/ Share on other sites More sharing options...
rhodesa Posted February 24, 2009 Share Posted February 24, 2009 when comparing items, you need to use a double equal sign: == if($type == "poem") { //Needed a double equal $title = $row['poem_name']; $text = $row['poem_text']; }elseif($type == "info") { //Needed a double equal $title = "INFO"; $text = "This is where the info should come"; } else { echo "<script type='text/Javascript'> alert('This page doesn't exist, or is under construction, you will now be redirected to the main page.'); </script>"; header('location:../../index.html'); }; Link to comment https://forums.phpfreaks.com/topic/146681-solved-_get-problem-3/#findComment-770103 Share on other sites More sharing options...
DEVILofDARKNESS Posted February 24, 2009 Author Share Posted February 24, 2009 Stupid that I didn't seen that Thanks a lot. Link to comment https://forums.phpfreaks.com/topic/146681-solved-_get-problem-3/#findComment-770112 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.