co.ador Posted January 22, 2010 Share Posted January 22, 2010 <?php echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage&name=". $_POST['name']. '&zipcode=' . $_POST['zipcode'] .'&state=' . $_POST['state'] . '&food_types= ' . $_REQUEST['frmSearch']['food_types']. '&offerings=' . if (isset ($_REQUEST['frmSearch']['offerings'])){$_REQUEST['frmSearch']['offerings']}else { array()} ."'>></a> ";?> I know the parse error laids in around the offering variable. <?php 'offerings=' . if (isset ($_REQUEST['frmSearch']['offerings'])){$_REQUEST['frmSearch']['offerings']}else { array()} ."' ?> Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/ Share on other sites More sharing options...
mapleleaf Posted January 22, 2010 Share Posted January 22, 2010 I don't think you can concatenate with a . if only $variable.$variable Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/#findComment-1000027 Share on other sites More sharing options...
laffin Posted January 22, 2010 Share Posted January 22, 2010 but ya can use the trenary operator. However, u have no routine to display an array, Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/#findComment-1000051 Share on other sites More sharing options...
co.ador Posted January 22, 2010 Author Share Posted January 22, 2010 i don't what you mean by routine but the link will show you some development on this topic http://www.sitepoint.com/forums/showthread.php?t=656501 Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/#findComment-1000091 Share on other sites More sharing options...
laffin Posted January 22, 2010 Share Posted January 22, 2010 echo array(1,2,3,4); will just output: Array as echo has no knowledge of handling anything besides ints/strings so you need a routine to handle the array and convert to int/string echo implode(' ',array(1,2,3,4); Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/#findComment-1000168 Share on other sites More sharing options...
co.ador Posted January 22, 2010 Author Share Posted January 22, 2010 the routine will be applied to the arrays or for all the indexes after the echo? Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/#findComment-1000192 Share on other sites More sharing options...
co.ador Posted January 23, 2010 Author Share Posted January 23, 2010 <?php echo "<a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage&name=". $_REQUEST['name']. '&zipcode=' . $_REQUEST['zipcode'] .'&state=' . $_REQUEST['state'] . implode('&food_types= ','&offering' array($_REQUEST['frmSearch']['food_types'] $_REQUEST['frmSearch']['offerings'])"'><</a> "; ?> Is this imploding fucntion done corretly? the above is a pagination link that will retrieve five indexes and two of them are arrays. I have put the two array inside the implode function and the rest outside it's that correct? Help! Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/#findComment-1000273 Share on other sites More sharing options...
spfoonnewb Posted January 23, 2010 Share Posted January 23, 2010 Maybe something like this: <?php echo "<a href='{$_SERVER['PHP_SELF']}?currentpage={$nextpage}&name={$_POST['name']}&zipcode={$_POST['zipcode']}&state={$_POST['state']}&food_types=".(is_array($_REQUEST['frmSearch']['food_types'])) ? implode(",", $_REQUEST['frmSearch']['food_types']) : ""."&offerings=".(is_array($_REQUEST['frmSearch']['offerings'])) ? implode(",", $_REQUEST['frmSearch']['offerings']) : ""."'>The Link Text</a>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/#findComment-1000282 Share on other sites More sharing options...
co.ador Posted January 23, 2010 Author Share Posted January 23, 2010 ok i will test that Thank you. What's the function behind is_array? if you don't mind thank! Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/#findComment-1000284 Share on other sites More sharing options...
spfoonnewb Posted January 23, 2010 Share Posted January 23, 2010 Implode requires an array. If an array isn't provided (an empty or invalid $_REQUEST), you will get a PHP error. Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/#findComment-1000287 Share on other sites More sharing options...
co.ador Posted January 23, 2010 Author Share Posted January 23, 2010 I tried the follows but it's not activating the >> as a link. I think somewhere in between <a the script inside the <a open and the symbol > then it get lost the effect of activating the link. [code=php:0]<?php echo "<a href='{$_SERVER['PHP_SELF']}?currentpage={$nextpage}&name={$_POST['name']}&zipcode={$_POST['zipcode']}&state={$_POST['state']}&food_types=".(is_array($_REQUEST['frmSearch']['food_types'])) ? implode(",", $_REQUEST['frmSearch']['food_types']) : ""."&offerings=".(is_array($_REQUEST['frmSearch']['offerings'])) ? implode(",", $_REQUEST['frmSearch']['offerings']) : ""."'>>></a>"; ?> again the >> is not display as a link rather as a plain text with the script above. Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/#findComment-1000313 Share on other sites More sharing options...
co.ador Posted January 23, 2010 Author Share Posted January 23, 2010 still the problems persists. This is the output of the pagination [1] 2 '>»> >> you see >»> it won't link and if you notice in [1] 2 '>»> the apostrophe ' is part of the closing in the php script inside the <a> tags won't will appear as plain text. I don't see any missing tags or any missing parse characters in there. Hai!!!! Quote Link to comment https://forums.phpfreaks.com/topic/189452-another-parse-error-whats-wrong-here/#findComment-1000322 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.