Calling a Javascript function from PHP?

Devilz Wishbone

New member
I got a contact us page at the moment on my website
Naturally this uses PHP, There are 4 methods of contact

Phone
Postal
Live Chat
Email

The user can click on which method they wish to use on the page its self and using a javascript / ajaxing method the tables will expand or contract depending on the option the viewer selected.

I have also added a Windows Vista style menu where the user can click contact us (A drop down menu appears with the 4 methods of contact)

When the user click on one (lets say Email)

The URL becomes...

index.php?page=contact&method=email
(As the headers/page design remain the same only the content alters)

I have captured the method on the contact.php
But when I tell it to write into the page


<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT">
<?
$method = $_GET['method'];
switch ($method){
case "phone"; ?>
linktwo();
<? break;
case "email"; ?>
linkone()
<? break;
case "post"; ?>
linkfour()
<? break; }?>
</SCRIPT>

It does action it

The outcome is as i intended it to be on the HTML source code

<SCRIPT LANGUAGE="JavaScript" TYPE="TEXT/JAVASCRIPT">
linktwo();
</SCRIPT>

But it wont do anything, yet if you click on the images it will do it using HREF="Javascript:linktwo();"
 
Back
Top