-1

So I need to request an image from a database, this then gets put in a variable, and gets called up in an echo.
However, i'm in a shortage of quotemarks in this case, seeing as the PHP echo uses double quotes, And then after calling up the onmouseover I use the single quotemarks, but after that I cannot use the double quotemarks again for the URL that gets caled up, Going around this by putting the whole command in a variable didn't work.
Putting the whole command into the database didn't work.
Putting the command or url in a shorthand if statement didn't work.
And putting the Javascript code into a function, Also does not work.

Here is the code I'm talking about.

$afbeeldingurl = $row["afbeeldingurl"];
$overurl = $row["overafbeelding url"];

echo "<div><a href='../".$url.".html'><img onmouseover=mouseover() src='images/".$afbeeldingurl."' alt='' /></a>";


<script>
    function mouseover()
    {
        this.src='images/<?php$overurl?>';
    }

</script>

I thank you in advance :) (Note, Only Javascript allowed, I cannot call up Jquery)

  • 1
    You can escape quotemarks using \, so you will never run out of them. "\"" will become the string " in output – rypskar Sep 15 '17 at 07:59

1 Answers1

0
this.src='images/<?php$overurl?>';

Try switch this to

this.src='images/<?php echo $overurl; ?>';
sauero
  • 259
  • 2
  • 15