convert coding (from php to java)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bella1010
Forum Newbie
Posts: 12
Joined: Fri Apr 01, 2011 11:03 am

convert coding (from php to java)

Post by bella1010 »

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");
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: convert coding (from php to java)

Post by cpetercarter »

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>";

bella1010
Forum Newbie
Posts: 12
Joined: Fri Apr 01, 2011 11:03 am

Re: convert coding (from php to java)

Post by bella1010 »

solve it~ thanks~
Post Reply