Hello. I have this code that get's the number in this url http://mysite.com/flash.php?flash=1 it works as it should but the next & previous & Random buttons is not working, with the code bellow if i press them the url jsut changes to http://mysite.com/flash/index.php? and "flash=X" is not even appearing, why is this ? $play = $_GET['flash']; <center> <style type="text/css"> form {display : inline;} </style> <FORM METHOD="LINK" ACTION="index.php?flash=<? echo "$play++"; ?>"> <INPUT TYPE="submit" VALUE="Next >>"></form> <FORM METHOD="LINK" ACTION="index.php?flash=<? echo "$random2"; ?>"> <INPUT TYPE="submit" VALUE="<< Random >>"></form> <FORM METHOD="LINK" ACTION="index.php?flash=<? echo "$play--"; ?>"> <INPUT TYPE="submit" VALUE="<< Previous"></form> <? include 'foot.php'; ?> </center> PHP:
Try this syntax instead <?=$play++; ?> Also if you look at the source code of your page, you will notice that flash= does exist, if your using rewrite urls its possible thats what causing it to disappear...
Hey! Same problem, Even if i do this <FORM METHOD="LINK" ACTION="index.php?flash=2"> <INPUT TYPE="submit" VALUE="Next >>"></form> "?flash=2" will not appear in the URL even if i press "next" :/
Why do you use a form for each form? Why not use just a link? <a href="index.php?flash=<? echo "$play++";">Next >></a> PHP:
Not only does your opening and closing of PHP make no sense, you're code makes little to no sense... why (as daniel_r said) are you wasting a form and submit to do an anchor's job? Why are you using HTML 3.2 in writing the page? The mere presence of inlined CSS and a CENTER tag means whatever page this is going into needs to be thrown out and started over. Of course, your REAL problem is that you didn't close php before you started your markup after setting $play. Do you see a ?> in there? Again though, why if I had my way <?php ?> would be removed from PHP entirely as pointless, redundant, and possibly a security risk. That's one hell of a mess of nonsense for what should probably be a LIST (since it's related choices) containing ANCHORS... preferably not constantly opening and closing PHP for no good reason. $play = $_GET['flash']; echo ' <ul class="nextRandomPrev"> <li> <a href="index.php?flash=',$play+1,'">Next »</a> </li><li> <a href="index.php?flash=',$random2,'">« Random »</a> </li><li> <a href="index.php?flash=',$play-1,'">« Previous</a> </li> </ul>'; include('foot.php'); Code (markup): Assumes you are already inside <?php ?> You want to make them look like form inputs, that's what CSS is for -- usually you can even style them more attractive than form inputs and more reliably thanks to CSS3. I suspect you were chosing tags either based on their appearance, or from not understanding that if all you are sending is getdata, you don't need a form. .. and to be frank, if you are using STYLE as a tag, STYLE as an attribute, or tags like CENTER, you're doing it ALL WRONG in all but the rarest of circumstances. CENTER in particular says "look at me, I can haz intarnets style 1997?" Again, the wrong markup doing the wrong job!