PHPilliterate Posted January 19, 2008 Share Posted January 19, 2008 Howdy! I created a search page that redirected to cwplayers_Results...it was 1 list field and worked great. Then I decided to add a second field and make it into a LOGIN page as well. So....now something went kaputz!(the search resulted in getting all records)... I thought that editing the "redirect to URL" setting (in DW8) to the following line would work, but now i get "unexpected '\"', expecting T_STRING or T_VARIABLE or T_NUM_STRING" Can someone let me know where the problem is? $MM_redirectLoginSuccess = "cwplayers_Results.php?<?php echo((isset($_POST["S_team"]))?$_POST["S_team"]:"") ?>="; Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/ Share on other sites More sharing options...
mmarif4u Posted January 19, 2008 Share Posted January 19, 2008 I am not sure about code but try like this: "cwplayers_Results.php?<?php echo((isset($_POST["S_team"]))?>?<?php $_POST["S_team"]:"") ?>="; Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443310 Share on other sites More sharing options...
PHPilliterate Posted January 19, 2008 Author Share Posted January 19, 2008 I am not sure about code but try like this: "cwplayers_Results.php?<?php echo((isset($_POST["S_team"]))?>?<?php $_POST["S_team"]:"") ?>="; Still no luck with that change... I don't even know if my scripting is anywhere near close to working the way it should....... Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443312 Share on other sites More sharing options...
mmarif4u Posted January 19, 2008 Share Posted January 19, 2008 R u trying to pass two variables: Then try this: "cwplayers_Results.php?<?php echo((isset($_POST["S_team"]))?>&<?php $_POST["S_team"]:"") ?>="; Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443314 Share on other sites More sharing options...
revraz Posted January 19, 2008 Share Posted January 19, 2008 If you are already in PHP (since you have a variable at the start), why are you doing a <?php echo statement in the middle? Howdy! I created a search page that redirected to cwplayers_Results...it was 1 list field and worked great. Then I decided to add a second field and make it into a LOGIN page as well. So....now something went kaputz!(the search resulted in getting all records)... I thought that editing the "redirect to URL" setting (in DW8) to the following line would work, but now i get "unexpected '\"', expecting T_STRING or T_VARIABLE or T_NUM_STRING" Can someone let me know where the problem is? $MM_redirectLoginSuccess = "cwplayers_Results.php?<?php echo((isset($_POST["S_team"]))?$_POST["S_team"]:"") ?>="; Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443316 Share on other sites More sharing options...
PHPilliterate Posted January 19, 2008 Author Share Posted January 19, 2008 Here is an expanded view of my code. The first is from my search page that I tried to turn into a login page...The S_team field is what i want to pass as a variable to my results page.... // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); } $loginFormAction = $_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) { $_SESSION['PrevUrl'] = $_GET['accesscheck']; } if (isset($_POST['S_team'])) { $loginUsername=$_POST['S_team']; $password=$_POST['password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "cwplayers_Results.php?<?php echo((isset($_POST["S_team"]))?$_POST["S_team"]:"") ?>="; $MM_redirectLoginFailed = "cwreg.php"; $MM_redirecttoReferrer = false; mysql_select_db($database_alflregister, $alflregister); $LoginRS__query=sprintf("SELECT username, userpass FROM login WHERE username='%s' AND userpass='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $alflregister) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $_SESSION['MM_Username'] = $loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if (isset($_SESSION['PrevUrl']) && false) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> Here is the code from my RESULTS page: <?php $maxRows_WADAcwplayers = 1000; $pageNum_WADAcwplayers = 0; if (isset($_GET['pageNum_WADAcwplayers'])) { $pageNum_WADAcwplayers = $_GET['pageNum_WADAcwplayers']; } $startRow_WADAcwplayers = $pageNum_WADAcwplayers * $maxRows_WADAcwplayers; $Paramteam_WADAcwplayers = "-1"; if (isset($_GET['S_team'])) { $Paramteam_WADAcwplayers = (get_magic_quotes_gpc()) ? $_GET['S_team'] : addslashes($_GET['S_team']); } mysql_select_db($database_alflregister, $alflregister); $query_WADAcwplayers = sprintf("SELECT * FROM cwplayers WHERE (team LIKE '%%%s%%' OR '-1' = '%s') ORDER BY last ASC", $Paramteam_WADAcwplayers,$Paramteam_WADAcwplayers); $query_limit_WADAcwplayers = sprintf("%s LIMIT %d, %d", $query_WADAcwplayers, $startRow_WADAcwplayers, $maxRows_WADAcwplayers); $WADAcwplayers = mysql_query($query_limit_WADAcwplayers, $alflregister) or die(mysql_error()); $row_WADAcwplayers = mysql_fetch_assoc($WADAcwplayers); if (isset($_GET['totalRows_WADAcwplayers'])) { $totalRows_WADAcwplayers = $_GET['totalRows_WADAcwplayers']; } else { $all_WADAcwplayers = mysql_query($query_WADAcwplayers); $totalRows_WADAcwplayers = mysql_num_rows($all_WADAcwplayers); } $totalPages_WADAcwplayers = ceil($totalRows_WADAcwplayers/$maxRows_WADAcwplayers)-1; ?> Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443317 Share on other sites More sharing options...
sasa Posted January 19, 2008 Share Posted January 19, 2008 try $MM_redirectLoginSuccess = "cwplayers_Results.php?".((isset($_POST["S_team"]))?$_POST["S_team"]:"")."="; Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443320 Share on other sites More sharing options...
revraz Posted January 19, 2008 Share Posted January 19, 2008 And my question still remains... Here is an expanded view of my code. The first is from my search page that I tried to turn into a login page...The S_team field is what i want to pass as a variable to my results page.... Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443322 Share on other sites More sharing options...
PHPilliterate Posted January 19, 2008 Author Share Posted January 19, 2008 And my question still remains... Guess my answer would be "How the heLL should I know? I don't speak PHPenese!" ;D "Thats why i use DW8...it's suppose to do all that writing for me.... Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443323 Share on other sites More sharing options...
PHPilliterate Posted January 19, 2008 Author Share Posted January 19, 2008 try $MM_redirectLoginSuccess = "cwplayers_Results.php?".((isset($_POST["S_team"]))?$_POST["S_team"]:"")."="; That worked for getting past the error...but now the variable doesn't pass to my results page...shows all items in the list instead of the selected variable. Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443326 Share on other sites More sharing options...
Lukela Posted January 19, 2008 Share Posted January 19, 2008 lolx just try using an if statement above it and put it into a variable... Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443327 Share on other sites More sharing options...
sasa Posted January 19, 2008 Share Posted January 19, 2008 $MM_redirectLoginSuccess = "cwplayers_Results.php".((isset($_POST["S_team"]))?'?S_team='.$_POST["S_team"]:""); Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443329 Share on other sites More sharing options...
PHPilliterate Posted January 19, 2008 Author Share Posted January 19, 2008 $MM_redirectLoginSuccess = "cwplayers_Results.php".((isset($_POST["S_team"]))?'?S_team='.$_POST["S_team"]:""); Now it fails to pass the usercheck.... Does it matter that it has dblquotes around S_team in one line, but is single ' on other lines? Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443330 Share on other sites More sharing options...
PHPilliterate Posted January 19, 2008 Author Share Posted January 19, 2008 Does it matter that it has dblquotes around S_team in one line, but is single ' on other lines? $MM_redirectLoginSuccess = "cwplayers_Results.php?<?php echo((isset($_POST["S_team"]))?$_POST["S_team"]:"") ?>="; if (isset($_GET['S_team'])) { Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443333 Share on other sites More sharing options...
sasa Posted January 19, 2008 Share Posted January 19, 2008 it is same Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443336 Share on other sites More sharing options...
kenrbnsn Posted January 19, 2008 Share Posted January 19, 2008 Guess my answer would be "How the heLL should I know? I don't speak PHPenese!" ;D "Thats why i use DW8...it's suppose to do all that writing for me.... Then you should learn PHP. Don't assume that DW8 is going to produce good or even correct code. Learn how to do it yourself. You will thank yourself in the long run. Ken Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443480 Share on other sites More sharing options...
PHPilliterate Posted January 19, 2008 Author Share Posted January 19, 2008 Guess my answer would be "How the heLL should I know? I don't speak PHPenese!" ;D "Thats why i use DW8...it's suppose to do all that writing for me.... Then you should learn PHP. Don't assume that DW8 is going to produce good or even correct code. Learn how to do it yourself. You will thank yourself in the long run. Ken I am slowly learning...but very SLOWLY :o. But while I'm learning I still need to resolve this problem....The suggestions so far still have not helped :'( Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443564 Share on other sites More sharing options...
PHPilliterate Posted January 19, 2008 Author Share Posted January 19, 2008 Think i may have found the problem...but can't fugure out how to fix it. The original script has a form method of POST, but once I added a login server behavior, the method changes to POST....could that be the problem? Original code: <form action="cwplayers_Results.php" method="get" name="WADASearchForm" id="WADASearchForm"> <div class="WADAHeader">Search</div> <div class="WADAHorizLine"><img src="WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div> <table class="WADADataTable" cellpadding="0" cellspacing="0" border="0"> <tr> <th class="WADADataTableHeader">team:</th> <td class="WADADataTableCell"><input type="text" name="S_team" id="S_team" value="" size="32" /></td> </tr> </table> <div class="WADAHorizLine"><img src="WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div> <div class="WADAButtonRow"> <table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="WADADataNavButtonCell" nowrap="nowrap"><input type="image" hspace="0" vspace="0" border="0" name="Search" id="Search" value="Search" alt="Search" src="WA_DataAssist/images/Pacifica/Refined_search.gif" /></td> </tr> </table> </div> </form> Once I added the LOGIN behavior, this is what I get: <form action="<?php echo $loginFormAction; ?>" method="POST" name="WADASearchForm" id="WADASearchForm"> <div class="WADAHeader"></div> <div class="WADAHorizLine"><img src="WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div> <table class="WADADataTable" cellpadding="0" cellspacing="0" border="0"> <tr> <th class="WADADataTableHeader">Team:</th> <td class="WADADataTableCell"><select name="S_team" id="S_team"> <?php do { ?> <option value="<?php echo $row_Recordset1['team']?>"><?php echo $row_Recordset1['team']?></option> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); $rows = mysql_num_rows($Recordset1); if($rows > 0) { mysql_data_seek($Recordset1, 0); $row_Recordset1 = mysql_fetch_assoc($Recordset1); } ?> </select></td> </tr> <tr> <th class="WADADataTableHeader">Password:</th> <td class="WADADataTableCell"><input name="password" type="text" id="password" value="ENTER PASSWORD" /></td> </tr> </table> <div class="WADAHorizLine"><img src="WA_DataAssist/images/Pacifica/Refined_tx.gif" alt="" height="1" width="1" border="0" /></div> <div class="WADAButtonRow"> <table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="WADADataNavButtonCell" nowrap="nowrap"><input type="Submit" name="Search" id="Search" value="Search" /></td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443593 Share on other sites More sharing options...
PHPilliterate Posted January 19, 2008 Author Share Posted January 19, 2008 ooops..meant to say that the original was GET then it changed to POST Quote Link to comment https://forums.phpfreaks.com/topic/86741-solved-unexpected-expecting-t_string-or-t_variable-or-t_num_string/#findComment-443644 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.