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>

i can see the end of the

 </select>

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

This is the missng part.

<select>

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>

Why not using form submission

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

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.

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>

hello dears friensds i give the code up please help

Isn't this code working, if not then is it throwing any error or not!

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.