Need php help

hey friends,

I am a beginner and need your help for one of the issue i am facing.

In this form http://www.venturetravelclub.com/payment2/ , what I want is when a package is selected the correspondence price should be auto populated in the price field.

$GoodsName=array();
$GoodsName[‘01’]=‘Venture Travel Bronze Package: 3 vacations for $649.00’;
$GoodsName[‘02’]=‘Venture Travel Silver Package: 5 vacations for $499.00’;

$Amount=array();
$Amount[‘01’]=‘649’;
$Amount[‘02’]=‘499’;

and I need to send them through form submit to the next page, to do that I have assigned the values like this -

-- Select Travel Package -- <?php foreach($GoodsName as $key=>$val){?> <?=$val?> <?php } ?> -- Select Price-- <?php foreach($Amount as $key=>$val){?> <?=$val?> <?php } ?>

Can you please help me to auto-populate the price when package is selected , and also with the code to assign and send value to next page through form submission.

Regards

Jit

This just sends it to the same page, but you can easily send it to a different page ( The first if statement) and I don’t know what you doing with your html. I took some liberties and modified it. I personally don’t like jumping back and forth from PHP to HTML. I also like camel case my variables, for example you have $_POST[‘GoodsName’], I would had wrote it this way $_POST[‘goodsName’]. For me it makes it easier to read the code.

Here’s what I have
[php]<?php
if (isset($_POST[‘submit’]) && $_POST[‘submit’] == “Enter”) {
echo $_POST[‘GoodsName’] . ’ ’ . $_POST[‘Amount’] . ‘
’;
}
$GoodsName = array();
$GoodsName[‘01’] = ‘Venture Travel Bronze Package: 3 vacations for $649.00’;
$GoodsName[‘02’] = ‘Venture Travel Silver Package: 5 vacations for $499.00’;

$Amount = array();
$Amount[‘01’] = ‘649’;
$Amount[‘02’] = ‘499’;
?>

-- Select Travel Package -- <?php foreach ($GoodsName as $key => $val) { echo '' . $val . '' . "\n"; } ?> -- Select Price-- <?php foreach ($Amount as $key => $val) { echo '' . $val . '' . "\n"; } ?>
[/php]

This should give you a good start at least on how to get the data from a form to php. (I think ;))

Sponsor our Newsletter | Privacy Policy | Terms of Service