Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I am using this code in my controller and it's not working, showing parse error. Can you guys please help me out.
echo "<script> alert("<?php echo $v[$keys[$i+4]],"is going out of stock"; ?>"); </script>" ;
Thank you!
$v[$keys[$i+4]],"is going out of stock"
$v[$keys[$i+4]]."is going out of stock"
alert
You're not concatenating the static text correctly. Try this:
echo "<script> alert('" . $v[$keys[$i+4]] . " is going out of stock.'); </script>" ;
Add a comment
Required, but never shown
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.
Explore related questions
See similar questions with these tags.
$v[$keys[$i+4]],"is going out of stock"should be$v[$keys[$i+4]]."is going out of stock"dot not commaalertit locks the browser, use a modal overlay or other form of notification like a growl