php - Autopopulate textarea from database based on dropdown selection -


i trying autopopulate textarea values (wordpress) database based on value selected in select menu. select menu contains list of teams , wish populate textarea names of players selected team.

the problem need convert selected text php variable in order use query database. so:

php

$usergroups = $mingleforum->get_usergroups();  $team_title = $_get['usergroup']; $team_id = get_page_by_title( $team_title ); $players = get_users( array (                 'meta_key' => 'team-meta',                 'meta_value' => $team_id             ));  

js

jquery(function(jquery){  jquery('#usergroup').change(function() {    jquery.ajax({       type: "get",       url: "http://localhost:8888/dev_wordpress/wp-admin/admin.php?page=mfgroups&mingleforum_action=usergroups&do=add_user_togroup",       data: { usergroup: jquery(this).find(':selected').text() }   }).done(function( msg ) {     alert( "data saved: " + msg );      });     });   }); 

update: corrected url (based on @jterry 's comment) , no longer getting error (although still isn't working) getting following error: get http://localhost:8888/dev_wordpress/wp-admin/wpf-addusers.php?usergroup=coq+and+bulldog 404 (not found)

for points! :d

wpf-addusers.php doesn't exist @ path. specify absolute uri , you'll @ least make past 404 error. also, looks url parameter has "" on both sides of variable - need 1 on each side.

edit

to access variable you're looking (usergroup) use in php script, can use $_get['usergroup']. there, can use see fit or insert value of input element.

if use value in input element, sure use htmlentities escape value.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -