Jump to content

Restoring Form Values while using javascript history object with php


saikiran

Recommended Posts

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

[color=red]....
<script>
function doBack()
{
history.go(-1);
}
</script>[/color]
....

[size=10pt]the form is [/size]

[color=red]<?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>";
[/color]

cheers
sai

Link to comment
Share on other sites

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.

[color=red][quote]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.[/quote][/color]

cheers
sai
saisen76@hotmail.com

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.