i have problem to change the php coding to java script.
i want change this php coding to <script language='javascript'>. How? Below is my php code sentence:
echo "<a href='view_topic.php?id=".$id."'></a>";
then, how to change it to javascript?
change it like sample below:
echo "<script language='javascript'>
alert('Submitted!')
</script><script>window.location='view_topic.php'
</script>";
my problem is i dono how to put ?id=".$id." into javascript. have someone know how to insert ?id=".$id." into my javascript?
or else, change it to another format:
header("Location:view_topic.php");
convert coding (from php to java)
Moderator: General Moderators
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: convert coding (from php to java)
You do it in exactly the same way as when you echo html to the web page.
Code: Select all
echo "<script language='javascript'>
alert('Submitted!')
</script>
<script>
window.location='view_topic.php?id=$id'
</script>";
Re: convert coding (from php to java)
solve it~ thanks~