1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Rep Power
    i am programming a shopping cart, and want to be able
    to know where the product has to be sent, so i can count out
    the cost of shipment.

    in a form, i use this

    costs of shipment :

    < SELECT name="destination" >
    <OPTION value="0.00">Netherlands Free shipment</OPTION>
    <OPTION value="4.95">Europe + 4.95 </OPTION>
    <OPTION value="7.95 >United States + 7.95 </OPTION>

    this is code which is in a form, and i want that if the SELECT option changes,
    the whole form refreshes, and that that option is selected, and $destination gets the right value

    i know i can do it this way, but it's not the right way, and i don''t want to use javascript for it !

    <SELECT name="soort" onChange="window.location.href = 'form.php3?'+ 'destination='+this.form.destination.value">

    what i am looking for is something like this :

    onchange="<? $PHP_SELF ?>"

    and in the head of the php3 script,

    if isset($soort);
    $total_amount=$amount+$destination }
    else { $total_amount = $amount+0.00 } // standard setting for the Netherlands.

    this probably isn''t that difficult, but i can't find the right solution, other then the javascript solution ;(

    who helps me ??

    Many Thanks !

    Jan, The Netherlands.
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Caro, Michigan
    Rep Power
    You cannot have PHP code execute when a user changes a select box. You'd have to use Javascript for this. I think you've got the idea right when you use window.refresh code, then in the beginning of the file, you can look at the values of $destination and add that to $amount.

    Hope this helps at least a little...

    ---John Holmes

Similar Threads

  1. Updating text fields from dynamic SQL select box?
    By Trent Hatred in forum HTML Programming
    Replies: 3
    Last Post: February 6th, 2004, 10:34 AM
  2. prevent duplicate entries in select menu
    By SeenGee in forum PHP Development
    Replies: 2
    Last Post: February 6th, 2004, 07:08 AM
  3. Replies: 2
    Last Post: January 27th, 2004, 03:34 PM
  4. select verification onsubmit
    By DrStein in forum HTML Programming
    Replies: 3
    Last Post: January 20th, 2004, 03:16 AM
  5. select distinct problem
    By mrengc in forum MS SQL Development
    Replies: 1
    Last Post: December 23rd, 2003, 07:50 AM

IMN logo majestic logo threadwatch logo seochat tools logo