Jump to content

Recommended Posts

Hi everyone, i'm having an issue with executing a js command through php. The only problem as of now is that i'm trying to pass a variable which is a variable in my php script so I've done this:

 

echo "<p>". $classes[$i][0]." - ".$classes[$i][1]." <a href='#' onclick='deleteclass(".$classes[$i][0].")'>delete</a></p>";

 

The variable gets correctly passed into the deleteclass() funtion but I still need quote around the variable for it to work.

 

What is the correct syntax to make this work correctly?

Link to comment
https://forums.phpfreaks.com/topic/135914-solved-passing-js-variable-in-php/
Share on other sites

ok, what is currently happening is when the script is echoed back it ends up looking like this:

 

<p><a href="#" onclick="deleteclass(4A)">delete</a></p>

 

and I need to get quotes around the 4A so it'll execute...but I have all these quote in my php script but can't seem to get the right syntax

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.