GRooVeZ Posted April 19, 2012 Share Posted April 19, 2012 hi i have this code, wich deletes u from a list if succeeded it gives u a succes message, and forwards u to a page like this $mes="<b>succes<br />"; return success($mes,'./ffamatches.php'); this is working, now what i want is to put a var inthere $mes="<b>succes<br />"; return success($mes,'./ffamatches.php?id=$matchid'); but thats not working, how do i do this? this is the complete page <?php include("./includes/egl_inc.php"); $secure = new secure(); $secure->secureGlobals(); page_protect(); if($_SESSION['user']) { if (isset ($_GET['match'])) { $matchid = (int)$_GET['match']; }elseif($match) { $matchid = (int)$match; } $playersidcheck = $_COOKIE['tid']; $deleteQuery = "DELETE FROM ffa_signups WHERE matchid='$matchid' and playerid='$playersidcheck'"; $deleteResult = mysql_query($deleteQuery) or die(mysql_error()); $mes="<b>succes<br />"; return success($mes,'./ffamatches.php'); }else{ header('Location: ./login.php'); } include("$config"); ?> Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/261267-var-in-url/ Share on other sites More sharing options...
tipsmail7 Posted April 19, 2012 Share Posted April 19, 2012 when you use single quote (like <?php echo '$matchid'; ?>), so the output will be $matchid, not the value of the $matchid variable You could use double quote (") or concatenate the string with this success($mes,'./ffamatches.php?id=' . $matchid); reference: http://www.trans4mind.com/personal_development/phpTutorial/quotes.htm Quote Link to comment https://forums.phpfreaks.com/topic/261267-var-in-url/#findComment-1338867 Share on other sites More sharing options...
Maq Posted April 19, 2012 Share Posted April 19, 2012 GRooVeZ, in the future, place OR tags around your code. Quote Link to comment https://forums.phpfreaks.com/topic/261267-var-in-url/#findComment-1338887 Share on other sites More sharing options...
batwimp Posted April 19, 2012 Share Posted April 19, 2012 Just use a double quote instead of a single quote. PHP will parse variables that are inside double quotes, but not inside single quotes: return success($mes,"./ffamatches.php?id=$matchid"); Quote Link to comment https://forums.phpfreaks.com/topic/261267-var-in-url/#findComment-1338895 Share on other sites More sharing options...
GRooVeZ Posted April 20, 2012 Author Share Posted April 20, 2012 really appreciate it guys ! thanks ! and will do ... Quote Link to comment https://forums.phpfreaks.com/topic/261267-var-in-url/#findComment-1338956 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.