reload page - please help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Zurawolf
Forum Newbie
Posts: 1
Joined: Wed Jan 05, 2011 6:25 pm

reload page - please help

Post by Zurawolf »

Hi,

Could you write me code for reload index.php page using "onload" and sending $x=1 at the same time .


Thanks,

Zurawolf
User avatar
spedula
Forum Commoner
Posts: 81
Joined: Mon Mar 29, 2010 5:24 pm

Re: reload page - please help

Post by spedula »

May I ask why?

Code: Select all

<?php
if (!$_GET) {
	?>
    <form name="formName" action="index.php" method="get">
    <input type="hidden" value="1" name="x" />
    </form>
    <script>
		document.formName.submit()
	</script>
    <?php
}

else {
	$x = $_GET['x'];
	echo $x; // or whatever you want to do with the value
}
?>
Post Reply