0

hello friends
i have 3 variable in form option and it content diferent price of shipping and i have varile price of product, and and other variable who is the total, i would like when user choose shipping of his choice that the total change my code is below

<?php $shipping1='20.78';
          $shipping2='12.89';
          $shipping3='0.00';
          ?>
          <?php $totalpay=  ($row_total['sub_total'])+($shipping1);?>
            <option name="express" value="20.00"><?php echo $shipping1 ?> </option>
            <option name="free" value="0.00"><?php  echo $shipping2 ?> </option>
            <option name="zunaphone" value="12.00"><?php echo $shipping3 ?></option>
          </select><br>
          <label for="shipping">Total</label>
          <input name="total" type="text" value="<?php echo number_format ($totalpay, 2, '.',''); ?>" readonly>
3
Contributors
11
Replies
36
Views
3 Years
Discussion Span
Last Post by chrisschristou
0

i can see the end of the

 </select>

tag on line 9 , but where is the starting point??

Edited by Eagle.Avik

0

soory to didn't pay attetion when i posted this is the code and check the comment.

<select name="shipping" size="1"> // start of select
          <?php $shipping1='20.78';
          $shipping2='12.89';
          $shipping3='0.00';
          ?>
          <?php $totalpay=  ($row_total['sub_total'])+($shipping1);?> // when users select one of the below option that the $shipping1 change according
            <option name="express" value="20.00"><?php echo $shipping1 ?> </option> // first choice
            <option name="free" value="0.00"><?php  echo $shipping2 ?> </option> // second choice
            <option name="zunaphone" value="12.00"><?php echo $shipping3 ?></option> // third choice
          </select><br>// end fo select
          <label for="shipping">Total</label>
          <input name="total" type="text" value="<?php echo number_format ($totalpay, 2, '.',''); ?>" readonly>
0

i never listen about Submission please tell me more it will give me the solution i'm going to find more on network ;)

0

Can you post full code, i mean not a part but the full script.

<?php $totalpay= ($row_total['sub_total'])+($shipping1);?> //

In this code $row_total where did it come from

Form is html, though you can add jquery for validation, but you can only use html and php for submissions.

0

the

$row_total// is from database

and here is the whole form it is what you ask right ???

 <form name="valide" method="POST" action="<?php echo $editFormAction; ?>">
          <label for="Sub total"></label>
          <label for="shipping">Sub total</label><input name="subtotal2" type="text" value="<?php echo number_format($row_total['sub_total'], 2, '.', ''); ?>  EUR" readonly disabledid="subtotal2">
           <br>
          <label for="total"></label>
          <select name="shipping" size="1">
          <?php $shipping1='20.78';
          $shipping2='12.89';
          $shipping3='0.00';
          ?>
          <?php $totalpay=  ($row_total['sub_total'])+($shipping1);?>
            <option name="express" value="20.00">EUR <?php echo $shipping1 ?> </option>
            <option name="free" value="0.00">EUR <?php  echo $shipping2 ?> </option>
            <option name="zunaphone" value="12.00">EUR <?php echo $shipping3 ?></option>
          </select><br>
          <label for="shipping">Total</label>
          <input name="total" type="text" value="<?php echo number_format ($totalpay, 2, '.',''); ?>  EUR" readonly><br>
          <input name="date" type="hidden" id="date" value="<?php echo $row_total['']; ?>">
          <input name="sku" type="hidden" id="sku" value="<?php echo $row_total['']; ?>">
          <input type="hidden" name="client" id="client" value="<?php echo $_SESSION[''] ?>">
<input type="submit" name="button" id="button" value="Place an order">
<input type="hidden" name="MM_insert" value="valide">
        </form>

Edited by chrisschristou: mistake post before :D

0

this code work but i would like to change the $totalpay when user select one of the 3 option.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.