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! Quote 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. Quote 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>"; } Quote 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 Quote 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>"; } Quote 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>"; } Quote Link to comment https://forums.phpfreaks.com/topic/116155-get-help/#findComment-597348 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.