Re: [PHPLIB] Calling Javascript from php From: Alexander Aulbach (ssilk <email protected>)
Date: 01/23/00

On Sun, 23 Jan 2000, little kulit wrote:

}Let me explain what I'm trying to do and how far had
}i've gone through. I'm not sure if the approach to
}this is right or not.
}
}I generated a form using php. In that form I have a
}couple of selection boxes. One of those selection box
}(key) will decide the value of the other selection
}boxes. When a person chooses a value from the (key)
}selection box the other selection box will need to get
}its value from a database (postgresql) using that
}value as key. I'm using the onchange event in the
}form to call the javascript which in turn will open a
}new window ( another php script ) to access the
}database. My problem right now is I don't know how to
}pass the variables from the original php form to the
}javascript it is calling so that i can tell him which
}table to access, what variable to test those
}conditions, etc. I also don't know how to pass those
}information from the javascript to the new window (
}another php script ). And lastly how will the new
}window upon getting all the necessary data from the
}database pass it back to the original php form so that
}it can be seen in the selection boxes.

Sounds a little bit strange...

To give the data to any other window via javascript I define a js-function
in my form which opens the new window with the correct parameters.

OnChange will call this function with the parameters from your
form-input-field.

In the new window you can give back the values you need for your form with
the expression

opener.form.field.value=your_value_from_db
^^^^^^

But there are many examples in the web, which use this.

-- 

SSilk - Alexander Aulbach - Herbipolis/Frankonia Minoris - (0931)22032

- PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>. To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in the body, not the subject, of your message.