txshonk Posted June 16, 2010 Share Posted June 16, 2010 All I am realtively inexperienced in Web Development - but have recently begun developing a site. On a particular page I want to establish various check boxes. When the check boxes are selected and the submit button is clicked, I want to run a dymic query based on the checkboxes on a MySQl table and create a string that is passed into the url of a new window that has a MyWimpy audio player. I can get all the piece parts to work individually - but I think what I am running into is that since the php script to take the check box values and the sql/string generation are on the same page I am not getting the result I want - the $s_string value continues to be null. I am looking for suggestions here are snippets of the code <html> <body> <form name="player_refresh" method="post" action="javascript:js_link('http://www.mysite.com/player/player.php?queryWhere=music_id&queryValue= <?php query(); ?> ');"> <input type="checkbox" name="country" value="1"> Country <input name="Launch Music Player" type="submit" value="Launch Music Player"> </body> </html> <?php function query () { if(isset($_POST['country']) && $_POST['country'] == "1") { $s_style= " WHERE `style` = 'country'"; } require('../Connections/db.php'); $sql = "SELECT `music_id` FROM `music`"; mysql_select_db($database_db $db_Library); $s = $sql . $s_style; $result = mysql_query($s); while($row = mysql_fetch_array($result)) { if (strlen($query_player)>0) { $query_player = $query_player."|".$row['music_id'] ; } else { $query_player = $row['music_id'] ; } } print $query_player; } ?> Link to comment https://forums.phpfreaks.com/topic/204977-php-script-to-pass-a-string-to-url/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.