I am using Dreamweaver to create a site.
I have created my database within phpMyAdmin and have two tables set up that contain the data I wish to display on my site. (it is a football team site and the page I am editing displays player profiles).
I have set up a drop down box, which is connected to my players table in phpMyAdmin. This I have set to display surname of the player. (I've set up the recordset to retrieve all data from my "players" table)
Below that, I have another div which contains text that I want to display based on the selection on the drop down list. For example, Position, appearances, goals, assists, etc.
Position: Dynamic text to be displayed here
Appearances: Dynamic text to be displayed here
etc
(This data would come from the "players_info" table - but the two tables are connected via the player_id field which is contained in both)
What I can't seem to do is work out how to get the text to update when the user would select a player from the drop down list.
Any help would be greatly appreciated.
Thanks
James
You can do these using ajax function.
when you select a player name ,then javascript or jquery event will be called which include a php file.
This php file must contain the sql which fetch your desired player information.
when server give response, then display it your corresponding div
Related
I need complete sample code to Add or Remove Dynamic Dependent Select Box data from two mysql tables using jQuery with PHP Ajax
Dependent select data should be come these below tables. And should be add and remove button to add row.
Category
Sub Category
Below is sample data, but in this, dependent select data coming from only one mysql table.
https://www.webslesson.info/2019/09/add-or-remove-dynamic-dependent-select-box-using-jquery-with-php-ajax.html
Can any provide me sample demo with source code ?
Please this sample image
Please see this image, There are three tables, (1) Items, (2) Category, (3) Sub Category, I need same like this, but data should come from Category table and sub category table in dependent select boxes. And this is multi dynamic row. Can you give me all demo code, becuase I do not know about Jave,Ajax and jQuery.
Below is sample demo and source code weblink, But in this sample, He is getting data from only one table for both dependent boxes category and sub category. Data should be come from two tables both dependent boxes.
enter link description here
I hope you understand what I required.
Please refer the attached image.
We have the document_id and document_name in document_master table.
Now, when we select the document name from the dropdown, we need to display the corresponding document_id (for the selected document name) from the document_master table.
Can you please help us how to fix this?
you can always do an AJAX call to retrieve the related data from database. But, isn't it weird to retrieve the doc_ID based on doc_Name? usually its the other way around
Programming in Bootstrap and PHP I am trying to create a dynamic form which has the following.
User uses a dropdown to select number from 1 to 10.
The page then displays x number of dropdowns.
Each dropdown is the same and displays a list of userID from a MySQL table tblUsers
Once the user makes a selection from each dropdown, it then shows a second dropdown immediately underneath showing a list of videos from a second MySQL table tblVideos. Meaning that the second dropdown is based on the results from the first.
Once all dropdowns have been selected. Submit is pressed and the results are sent as an array to the table tblVideoStored
Any ideas how the PHP and MySQL would be in a simple form..
Based on what you plan to achieve, you may want to look into combining php with ajax (Javascipt). Below are some examples that should set you on the right path
https://www.sitepoint.com/community/t/using-ajax-to-populate-dropdown-menu/4350/2
http://blog.chapagain.com.np/using-jquery-ajax-populate-selection-list/
I have a search form that the user uses to find persons from the database, the results are displayed on a table, then the user can choose persons from the results table and add them or remove them from another table (the CGridView) and this last table will be saved to the database when the user clicks save button. My problem is that I'm adding and removing the persons (the rows) with jQuery, so when I use the sort function of the CGridView, clicking any header, the rows that were added with jQuery are lost. Also, when I remove rows from the last table I want to refresh the table so the zebra style rearranges. How can I do this without losing the data added with jQuery?
I'm building a web-app that allows people to select their US state from a drop-down box, displaying a telephone number for that area, however I'm having some difficulty doing so.
I've built the rest of the site in PHP and realise that this is a client side action, so I'd need to use JavaScript or Jquery.
Each state has a different number, so for example when Columbia is select I want to show the number for Columbia in a div next to the text box.
The values can be stored in a MySQL database if needed.
Any help would be greatly appreciated.
When you pull the data out to put into the drop down box store the telephone number as the 'value' of each option.
Then you can just set the div text to be $('getCheckBox').val().
$('dropdown').change(function(){
id = $(this).val();
myFucntionDoToWhateverIwantItToDo(id);
});
function myFucntionDoToWhateverIwantItToDo(id){
// Do stuff in the div, baby. The ID is stored in id.
$("div").empty().append(id);
}
Obviously replace dropdown and div with their real ids or classes