Jump to content

need help about embedding javascript into php


doforumda

Recommended Posts

hi i want to embed javascript in php code how can i embed the javascript in the following code

 

  echo "<tr>

    <td>".$record['statVal_id']."</td>

    <td>".$record['firstname']."</td>

    <td>".$record['lastname']."</td>

    <td>".$record['region']."</td>

<td><input type = 'button' name = 'edit1' value = 'Edit' onclick='javascript(go2Page(".$record['statVal_id']."));></td>

    </tr>";

I'm guessing you're having problems with the quotes in this bit?

'javascript(go2Page(".$record['statVal_id'].")

 

Use backslashes like this,

'javascript(go2Page(".$record[\'statVal_id\'].")

 

It's explained on http://php.net/types.string

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.