Vivid Lust Posted July 23, 2008 Share Posted July 23, 2008 When the get "deleten" doesnt exist, the code still executes as if it did. Basically, here's my code: <?php $get = $_GET['deleten']; if($get !== ""){ echo "File deleted at: <a href=http://".$_SERVER["HTTP_HOST"].$get.">".$_SERVER["HTTP_HOST"].$get."</a>"; } else { echo "<br>"; } ?> All the time the "echo "File deleted at: <a href=http://".$_SERVER["HTTP_HOST"].$get.">".$_SERVER["HTTP_HOST"].$get."</a>";" displays, i think my coding is bad, please help xd thanks in advanced! Link to comment https://forums.phpfreaks.com/topic/116155-get-help/ Share on other sites More sharing options...
waynew Posted July 23, 2008 Share Posted July 23, 2008 <?php $get = $_GET['deleten']; if($get != ""){ echo "File deleted at: <a href=http://".$_SERVER["HTTP_HOST"].$get.">".$_SERVER["HTTP_HOST"].$get."</a>"; } else { echo "<br>"; } ?> Try that. Link to comment https://forums.phpfreaks.com/topic/116155-get-help/#findComment-597323 Share on other sites More sharing options...
JonnyThunder Posted July 23, 2008 Share Posted July 23, 2008 try... if isset($_GET['deleten']) { $get = $_GET['deleten']; echo "File deleted at: <a href=http://".$_SERVER["HTTP_HOST"].$get.">".$_SERVER["HTTP_HOST"].$get."</a>"; } else { echo "<br>"; } Link to comment https://forums.phpfreaks.com/topic/116155-get-help/#findComment-597324 Share on other sites More sharing options...
ignace Posted July 23, 2008 Share Posted July 23, 2008 $get = $_GET['deleten']; // if not set in the url a null value will be set for $get; if ($get !== "") // null !== ""(string) thus execute what is on the next line Link to comment https://forums.phpfreaks.com/topic/116155-get-help/#findComment-597325 Share on other sites More sharing options...
waynew Posted July 23, 2008 Share Posted July 23, 2008 Go with Johnnys way. Also, your link is wrong. You're (or were) missing a quote to the left of the URL. if isset($_GET['deleten']) { $get = $_GET['deleten']; echo "File deleted at: <a href=\"http://".$_SERVER["HTTP_HOST"].$get."\">".$_SERVER["HTTP_HOST"].$get."</a>"; } else { echo "<br>"; } Link to comment https://forums.phpfreaks.com/topic/116155-get-help/#findComment-597329 Share on other sites More sharing options...
ignace Posted July 23, 2008 Share Posted July 23, 2008 yeah and johnny is missing a ( if (isset($_GET['deleten']) { $get = $_GET['deleten']; echo "File deleted at: <a href=\"http://".$_SERVER["HTTP_HOST"].$get."\">".$_SERVER["HTTP_HOST"].$get."</a>"; } else { echo "<br>"; } Link to comment https://forums.phpfreaks.com/topic/116155-get-help/#findComment-597348 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.