John Davidson

html - Values changed dynamically by an option (PHP)

0 comments
Message:


I would like to know if I can display values dynamically depending on a selected option without loading the PHP site again without using Ajax ?


                <FORM>
<SELECT name="Langage" size="1">
<OPTION selected value="en">English
<OPTION value="fr">Français
<OPTION value="es">Español
<OPTION value="de">Deutsche
</SELECT>
</FORM>

Can I use only some if php to change these :


    <th scope="col"><?php echo T::var1; ?></th>
<th scope="col"><?php echo T::var2; ?></th>
<th scope="col"><?php echo T::var3; ?></th>


My Answer:
Yes, you can achieve this using JavaScript. You can create a JavaScript function that listens for changes in the selected option and then dynamically update the values on the page without reloading the PHP site.

Here is an example of how you can do this:

html



Dynamic Values





Value 1


Value 2


Value 3









In this example, we have a select element with three options and three paragraphs that display values. When an option is selected, the `updateValues` function is called, which updates the text of the corresponding paragraph based on the selected option.

This way, you can dynamically change values on the page without reloading the PHP site or using Ajax.

Rate this post

5 of 5 based on 7176 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us