Jump to content


Photo

Restoring Form Values while using javascript history object with php


  • Please log in to reply
2 replies to this topic

#1 saikiran

saikiran
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 12 July 2006 - 05:44 AM

hi,

Thank u all. for the last two problems, i have posted, i got the answer and i finished it also. thank you very much.

I just want to know, whether it is possible for retaining posted form values, when user presses the back buttton which is using the javascript history command.

What i want to do is, when user posted the values, i have to take them to the confirmation or update page, if they press confirm, then the values will be stored into our database, if they press update, they have to go back to the previous and can edit the values.

Here the form is dynamically generated using PHP. I tried this, i can able to go back, but not able to get the form values.

kindly help me out.


the script is

....
<script>
function doBack()
{
history.go(-1);
}
</script>

....

the form is

<?php
echo "<form method='POST' action='ord_confirm.php' name='confirm_form'>";
echo "<input type='hidden' name='Sno{$j}' value='{$GLOBALS['item_no']}'>";
echo "<input type='hidden' name='pr_cat{$j}' value='{$GLOBALS['prod_cat']}'>";
echo "<input type='hidden' name='qty_req{$j}' value='{$GLOBALS['qty']}'>";
echo "<input type='hidden' name='gsm{$j}' value='{$GLOBALS['gsm']}'>";
echo "<input type='hidden' name='desc{$j}' value='{$GLOBALS['desc']}'>";
echo "<input type='hidden' name='quality{$j}' value='{$GLOBALS['quality']}'>";
echo "<input type='hidden' name='width{$j}' value='{$GLOBALS['width']}'>";
echo "<input type='hidden' name='length{$j}' value='{$GLOBALS['length']}'>";
echo "<input type='hidden' name='quan{$j}' value='{$GLOBALS['quan']}'>";
echo "<input type='hidden' name='unit{$j}' value='{$GLOBALS['unit']}'>";
echo "<input type='hidden' name='price{$j}' value='{$GLOBALS['price']}'>";
echo "<input type='hidden' name='uprice{$j}' value='{$GLOBALS['uprice']}'>";
echo "<input type='hidden' name='remark{$j}' value='{$GLOBALS['remark']}'>";
echo "<input type='hidden' name='dis{$j}' value='{$GLOBALS['dis']}'>";
echo "<input type='hidden' name='un_k{$j}' value='{$GLOBALS['un_k']}'>";
//echo "<input type='hidden' name='un_k{$j}' value='{$GLOBALS['un_k']}'>";
$j++;

                  <?php }

                echo "<input name='ret_tot' type='hidden' value='$j'>";
echo "<input type='hidden' name='enq_type' value='$enq_type'>";
echo "<input type='submit' name='ok' value='CONFIRM'>";
echo "<input type='reset' name='cancel' value='CANCEL' onclick='doBack();'";
        echo "</form>";


cheers
sai



#2 keeB

keeB
  • Staff Alumni
  • Advanced Member
  • 1,078 posts
  • LocationCalifornia

Posted 12 July 2006 - 05:50 AM

Can't be done AFAIK using IE back button, but creating your own LINK with the back button could work.

Why would you want to support this feature?

Come visit my site to see my latest projects
http://nick.stinemates.org/wordpress/


#3 saikiran

saikiran
  • Members
  • PipPip
  • Member
  • 24 posts

Posted 12 July 2006 - 06:03 AM

hi keeB,

i want this option so that user can edit there values if they want to .

I have seen this is normal shopping cart sites, where in which we can anytime update the quantity values or how much we want. I know they are made of pure PHP, in my case, it is not a shopping cart, so i am just looking for a quick work for this.

if you know, kindly tell me the logic for this.

note: I am not using browser's back button directly, there will be a button called update, when user clicks this button then it should go.



cheers
sai
saisen76@hotmail.com






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users