I’ve recently installed WP 2.0.2 on my site and am trying to integrate this little PHP script I did in the past.
Basically, it lets you rate a picture (in this case, rather than “hotness”, it’s “grossness”) and then it spits this into a mySQL table so you can keep track of the top gross and least gross pictures.
The old PHP script is here:
And I tried adding the PHP code (with formatting junk stripped out) to a gross.php template and created a new page with gross.php as the template. Currently this is named “testgross” under my pages on the site:
(yes, the formatting is all wonky still; I’ve not played with that yet)
Anyway, the voting works by passing an argument op=rate through the form.
Well, this argument doesn’t survive the WordPress URL rewriting and all.
For example, the script has a line saying:
if ($op == ‘rate’)
…but the code in this block never gets executed (the PHP script never realizes op == rate).
Is there any way to pass arguments to PHP code within templates such that the arguments survive whatever WordPress does to it?
- The topic ‘Passing arguments to PHP scripts within WordPress?’ is closed to new replies.