API の歌詞コードを動作させることができました。私が直面しているのは小さな問題です: ユーザーがテキストボックスに曲名を入力して送信ボタンをクリックすると、getElementById を介して値を取得し、それを以下の URL に追加するにはどうすればよいですか?
これが私のコードです:
<?php
//Catches the value of the Submit button:
$submit = isset($_POST['submit']);
if($submit) {
?>
<script type="text/javascript">
var val1 = document.getElementById('val').value;
</script>
<?php
/* The below $res contains the URL where I wanna append the caught value.
Eg: http://webservices.lyrdb.com/lookup.php?q=Nothing Else Matters(Or
what the user searches for)&for=trackname&agent=agent
*/
$res = file_get_contents("http://webservices.lyrdb.com/lookup.php?q='+val1+' &for=trackname&agent=agent");
?>
<html>
<form method="post" action="">
Enter value: <input type="text" name="value" id="val" /><br/>
<input type="submit" value="Submit" name="submit" />
</form>
</html>
このコードのどこが間違っているかを教えてください。このフォーラムのすべての助けに感謝します! :)