passing multiple php variables to javascript function with href

href="javascript:openForm1(,, )">

I am trying to use the code above to pass variables to a javascript function but it is not working. nothing happens when i click on the edit image.

2 thoughts on “passing multiple php variables to javascript function with href”

  1. You should use single quote then pass variable like below

    <?php $RoomTypeId = $record['RoomTypeId']; ?>
    <?php $RoomTypeName = $record['RoomTypeName']; ?>
    <?php $RoomTypeRate = $record['RoomTypeRate']; ?>
    
    <a href="javascript:openForm1('<?php echo $RoomTypeId ;?>','<?php echo $RoomTypeName;?>','<?php echo $RoomTypeRate;?>')"><img src="images/edit.png" height="15" width="15"></a>
    
    Reply

Leave a Comment