ifyrlucky Posted April 11, 2006 Share Posted April 11, 2006 when a customer goes to a specific page I want them redirected to their own page. I have set up the redirect code and created a database that has a URL address for each client. What I'm having a problem with is pulling the specific client URL from within the php redirect code. I keep on getting an error message on the page. The Code I'm using is below. How can I pull up the clients URL address under location without getting an error message?if($HTTP_HOST=="www.napoleonp.org/ikaika/redirect.php" or $HTTP_HOST == "napoleonp.org/ikaika/redirect.php"){ header("Location: <?php echo($row_rsCWGetCustomerData["cst_weburl"]); ?>");}?> Quote Link to comment https://forums.phpfreaks.com/topic/7094-redirect-code/ Share on other sites More sharing options...
shortj75 Posted April 11, 2006 Share Posted April 11, 2006 this is php code already you some <? ?> you dont need that may be you problem try this[code]<?if($HTTP_HOST=="www.napoleonp.org/ikaika/redirect.php" or $HTTP_HOST == "napoleonp.org/ikaika/redirect.php"){header("Location: echo($row_rsCWGetCustomerData[cst_weburl]); ");}?>[/code]that should work Quote Link to comment https://forums.phpfreaks.com/topic/7094-redirect-code/#findComment-25755 Share on other sites More sharing options...
ifyrlucky Posted April 11, 2006 Author Share Posted April 11, 2006 I tried the new code without the <? ?>. I now get a Parse error: parse error, unexpected $ in /htdocs/www/ikaika/redirect.php on line 7using <?php require_once("application.php");?><?php include("CWIncLoginForm.php");?><?php if (isset($_SESSION["customerID"]) && $_SESSION["customerID"] != "0") { ?><?phpif($HTTP_HOST=="www.napoleonp.org/ikaika/redirect.php" or $HTTP_HOST == "napoleonp.org/ikaika/redirect.php"){header("Location: echo($row_rsCWGetCustomerData[cst_weburl]); ");}?>Any Ideas why I'm getting this error?[!--quoteo(post=363560:date=Apr 11 2006, 12:32 AM:name=shortj75)--][div class=\'quotetop\']QUOTE(shortj75 @ Apr 11 2006, 12:32 AM) [snapback]363560[/snapback][/div][div class=\'quotemain\'][!--quotec--]this is php code already you some <? ?> you dont need that may be you problem try this[code]<?if($HTTP_HOST=="www.napoleonp.org/ikaika/redirect.php" or $HTTP_HOST == "napoleonp.org/ikaika/redirect.php"){header("Location: echo($row_rsCWGetCustomerData[cst_weburl]); ");}?>[/code]that should work[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/7094-redirect-code/#findComment-25767 Share on other sites More sharing options...
shortj75 Posted April 11, 2006 Share Posted April 11, 2006 try this [code]header("Location: echo($row_rsCWGetCustomerData[cst_weburl])");[/code]i see i forgot the ") at the end Quote Link to comment https://forums.phpfreaks.com/topic/7094-redirect-code/#findComment-25769 Share on other sites More sharing options...
wildteen88 Posted April 11, 2006 Share Posted April 11, 2006 Umm, you dont need to use echo when getting value from variable to be used in a funtion. The following should work:[code]header("Location: $row_rsCWGetCustomerData['cst_weburl']");[/code] Quote Link to comment https://forums.phpfreaks.com/topic/7094-redirect-code/#findComment-25772 Share on other sites More sharing options...
ifyrlucky Posted April 12, 2006 Author Share Posted April 12, 2006 I tried the new code and got the following error.Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /htdocs/www/ikaika/redirect.php on line 6again the code used was:<?php require_once("application.php");?><?php include("CWIncLoginForm.php");?><?php if (isset($_SESSION["customerID"]) && $_SESSION["customerID"] != "0") { ?><?if($HTTP_HOST=="www.napoleonp.org/ikaika/redirect.php" or $HTTP_HOST == "napoleonp.org/ikaika/redirect.php"){header("Location: $row_rsCWGetCustomerData['cst_weburl']");}?>sorry for all the problems.quote name='wildteen88' date='Apr 11 2006, 01:43 AM' post='363577']Umm, you dont need to use echo when getting value from variable to be used in a funtion. The following should work:[code]header("Location: $row_rsCWGetCustomerData['cst_weburl']");[/code][/quote] Quote Link to comment https://forums.phpfreaks.com/topic/7094-redirect-code/#findComment-26104 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.