...

View Full Version : posting to the current page



alex57
12-22-2006, 01:33 AM
hello,

Is it possible to post a value to the current page and display it when the page reloads?. For example if I am on 'page1.php' and usign a form to post a variable to 'page1.php', would this be possible. Possible code below: Any other suggestions if this wouldn't work??

This is code for page1.php


<?php
echo $_POST['selection'];
?>


<form action="page1.php" method="post">
<select size=1 name="selection" onchange="this.form.submit();">
<option value="goalkeeper">Goalkeeper</option>
</select>
</form>

Majoracle
12-22-2006, 01:38 AM
<?php
echo $_POST['selection'];
?>


<form action="<? $_SERVER[PHP_SELF] ?>" method="POST">
<select size=1 name="selection" onchange="this.form.submit();">
<option value="goalkeeper">Goalkeeper</option>
</select>
</form>

That should do it.

TrainReq
12-22-2006, 01:40 AM
<form method="POST">
Can also make it post as well



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum