HughbertD Posted February 12, 2008 Share Posted February 12, 2008 I want to add 10 to the value startrow in my URL echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+10).'">Next</a>'; Is that correct? It seems like it is simply assigning startrow to be 10 rather than adding anything Quote Link to comment https://forums.phpfreaks.com/topic/90662-is-this-the-correct-way-to-add-to-a-variable/ Share on other sites More sharing options...
thebadbad Posted February 12, 2008 Share Posted February 12, 2008 Yes, that seems right. Try to echo your $startrow and see what you get. Quote Link to comment https://forums.phpfreaks.com/topic/90662-is-this-the-correct-way-to-add-to-a-variable/#findComment-464724 Share on other sites More sharing options...
wildteen88 Posted February 12, 2008 Share Posted February 12, 2008 Make sure you are grabbing the existing value for the URL variable startrow, ge: $startrow = $_GET['startrow']; Otherwise the startrow variable wont increment. // grab current startrow value $startrow = $_GET['startrow']; // display link and increment startrow by 10 echo '<a href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+10).'">Next</a>'; Quote Link to comment https://forums.phpfreaks.com/topic/90662-is-this-the-correct-way-to-add-to-a-variable/#findComment-465134 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.