I’m trying to get this piece of code working:
<?php
$color_animation = $_GET['color_animation'];
if ( $color_animation == "1" ) {
echo "timer2 = setInterval(function() {
$('.scar_box').animate( { backgroundColor: '#fee993' }, 1000)
.animate( { backgroundColor: '#f8d95d' }, 1000);
}, 3000);";
}
?>
But it trows me the error: Invalid regular expression flag b
And: <b>Notice</b>: Undefined index: color_animation in <b>C:\xampp\htdocs\index.php</b> on line <b>117</b><br />
It doesn’t matter what i write into the $_GET it still has this problem.
Okay, I missed that bit. But you gave the answer away:
The raw
#separates the “fragement identifier” from the URL parameters. You need to useurlencode()in PHP orencodeURIComponent()for Javascript.Or just use
%23in its place. (That’s the ASCII number equivalent for the#number sign.)