Forum Moderators: coopster

Message Too Old, No Replies

Help Adding variable data to a PHP3 URL

Cybershop Shopping Cart

         

TrevR

7:38 am on Jun 24, 2005 (gmt 0)

10+ Year Member



I am new so please allow for this when reading the description of my problem.

We are trying out the Cybershop shopping cart. It allows you to generate links on the fly which are then used by customers to buy goods. The format is:

http://www.example.com/basket.php3?shopName=YOURSHOP &execute=buyme&productCode= &productName=YOURPRODUCT&price=YOURPRICE&depositextra=0
&extra1name=&extra1=&type=NORMAL&shippingUK=0.00&shippingEurope=0.00&shippingROW=0.00

My problem is that for one particular function I want buyers to be able to enter their own productName and price and then click on a submit button to send it to the shopping cart in the format above.

Using my very limited knowledge I tried the following form which does not work:

<form method="post" action='http://www.example.com/basket.php3' >
<input type="hidden" name="shopname" value="myshopnamegoeshere">
<input type="hidden" name="execute" value="buyme">
<input type="hidden" name="productcode" value="">
<input type="text" name="productName" >
<input type="text" name="price" >
<input type="hidden" name="depositextra" value="0">
<input type="hidden" name="extra1name" value= "">
<input type="hidden" name="extra1" value= "" >
<input type="hidden" name="type" value="NORMAL">
<input type="hidden" name="shippingUK" value="0.00">
<input type="hidden" name="shippingEurope" value="0.00">
<input type="hidden" name="shippingROW" value="0.00">
<input type="submit" name="Submit" value="Submit">

</form>

any assistance would be appreciated

[edited by: jatar_k at 4:09 pm (utc) on June 24, 2005]
[edit reason] generalized urls [/edit]

Burner

7:57 am on Jun 24, 2005 (gmt 0)

10+ Year Member



I'll put in my 2 cents, but I don't know a thing about that software.

I'm not sure you can fix your issue without access to modify the php code. Problem is how do you validate that the product name and price exists and is accurate from the SQL database when the user enters all details freeform? What if the user enters in a price of 0.00 or 0.01? What about slight misspellings?

Without some post processing to clean up the strings and check parameters, I think it's better for you to not even try making the software so open.

Good luck,
Burner

TrevR

9:29 am on Jun 24, 2005 (gmt 0)

10+ Year Member



Hi

changed Post to Get, capitalised a couple of letters I had in lower case and it worked :-)

Thanks for the advice on making sure the data is correct, that is phase II!