[thelist] PHP and POST

Beau Hartshorne beau at members.evolt.org
Thu Sep 13 16:06:21 CDT 2001


I am creating an ecommerce application, and wanted to send a variable
that would invoke a function to increment a particular item in the
shopping cart. If I use a querystring, I'm know that some user will get
upset once they hit reload, and inadvertantly add another item to the
cart.

I wanted to do this with text instead of a form button or image, and I
was wondering if it were possible.

Here is an example using JavaScript. I do not want to use JavaScript.
 From php-general:

<a href="javascript:setvars('var1value', 'var2value')">click here to go
to
next page</a>

<script language="JavaScript">
<!--
  function setvars(var1, var2)
  {
    df = document.dataform;
    df.var1.value = var1;
    df.var2.value = var2;
    df.submit();
  }
//-->
</script>
<form name="dataform" action="page2.php" method="post">
<input type='hidden' name='var1'>
<input type='hidden' name='var2'>
</form>

> Are you avoiding the query string on the get line because it 
> shows in the address bar of a browser?  Why don't you want to 
> use forms?
> 
> I'm only asking because I can't think of any other way of 
> posting data, and maybe we can think of a way of working 
> around what it is you're trying to avoid.
> 
> Mark





More information about the thelist mailing list