Discuss PHP Increment/Decrement in the PHP Development forum on Dev Shed. PHP Increment/Decrement PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
Posts: 5
Time spent in forums: 43 m 50 sec
Reputation Power: 0
PHP Increment/Decrement
This might sound a bit noobish but I am having trouble creating a increment/decrement button. So basically, I created a website that uses Tumblr feed to view photos that I've tagged. For example, if I pass a variable called "nav" that equals california, it will show all of my photos from california by using this code.
I want to be able to add a button to change the variable after "page/". And another thing is, the first page cannot read "page/1", because when I do it doesn't show anything. So the first page has to be the first script, and then after they press a "next" button, it has to go to the second code. I've gotten this so far:
Posts: 1,854
Time spent in forums: 1 Month 2 Weeks 1 Day 15 h 10 m 12 sec
Reputation Power: 813
Hi,
yeah, msteudel changed the code to make debugging easier. All you need to do is copy the forgotten "page" input into your code.
But before you do anything else, you need to fix some giant security holes. Both of you happily dumped the user input into the HTML markup, making the page vulnerable to XSS attacks. Any value you "echo" or "print" or output in any way must be escaped first with htmlentities(). Otherwise I could inject JavaScript via the URL, share the link with other users and then use the script to "capture" their browser (I could steal their cookies, redirect them to any page I want etc.).