1

Im geting the error in the title it marks only ">" in the end of line 2 i have tried to change it to /> or simple thing like that but it seems not working at all... the idea is to make a button that will send onclick this function using the ownerId That i gave using PHP. if it does matter [ownerId] => ec8d1073-544e-4330-bc9c-6fcfc3fe9bab thanks for reading and thanks again if you sent any help

<button onclick="SendCommMessageToOwner(<? echo $comm_data->info->ownerId; ?>)"
                    type="submit" class="elementor-button elementor-size-sm button-color-comm"> // right here
                    
                        <span>
                            <span class=" elementor-button-icon">
                            </span>
                        <span class="elementor-button-text">שליחה</span>
                        </span>
                    </button>
1
  • Did you try to put the php code inside single quotes? like '<? ... ?>' Commented Jul 28, 2020 at 23:01

1 Answer 1

1

This sounds like a JavaScript syntax error, not a PHP syntax error. So what is the JavaScript code in the browser that causes the error? You're not showing it, but you provide a clue:

if it does matter [ownerId] => ec8d1073-544e-4330-bc9c-6fcfc3fe9bab

So the JavaScript code will be:

SendCommMessageToOwner(ec8d1073-544e-4330-bc9c-6fcfc3fe9bab)

Yup, that's a syntax error alright. I suspect you meant for that to be a string literal:

SendCommMessageToOwner('ec8d1073-544e-4330-bc9c-6fcfc3fe9bab')

Which means you're just missing the quotes in your markup (outside of the server-side code in this case):

<button onclick="SendCommMessageToOwner('<? echo $comm_data->info->ownerId; ?>')" ...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.