Jump to content

PHP <iframe> syntax help


shamuraq

Recommended Posts

hi all...

i have a bit of a pain from my own incompetency... So i would be grateful fer any help rendered...

 

<?php
$e = date('dmy');
$f = mt_rand(1,99);
$f = $file.".svg";
?>
<td><?php echo "<iframe src=  \$e"."\$f"."\ width=\"400\" height=\"250\" frameborder=\"0\" scrolling=\"no \"></iframe>";?></td>

The error that i get from parsing that in browser is:

The requested URL /testing/SystemDirectory/280610$f\ width= was not found on this server.

 

I've got a gut feeling that my <iframe> syntax is erroneous... Is regex involved?

Link to comment
Share on other sites

<?php echo '<iframe src="' . $e . $f . '" width="400" height="250" frameborder="0" scrolling="no"></iframe>";?>

 

A bit cleaner then what you had and should work properly, given that the url is correct.

Link to comment
Share on other sites

Is there more code? Not seeing where $file is coming from...

 

Just saw that right now, you're overwriting your $f variable too. (It almost looks like the first $f should be $file?? Not sure what you're trying to do there)

Link to comment
Share on other sites

sorry.. my mistake...

<?php
$e = date('dmy');
$f = mt_rand(1,99);
$f = $f.".svg";
?>
<td><?php echo "<iframe src=  \$e"."\$f"."\ width=\"400\" height=\"250\" frameborder=\"0\" scrolling=\"no \"></iframe>";?></td>

Link to comment
Share on other sites

I am trying to back track to find out if it is the syntax structure or something else and decided to go static fer a bit

This is more mind-boggling....

When i changed it to:

<table width="200" border="1">
  <tr>
    <td> 
      <iframe src= "../SystemDirectory/280610/1.svg" width="400" height="250" frameborder="0" scrolling="no"></iframe>
      
    </td>
  </tr>
</table>

 

It worked fine...

 

But when i changed it to:

<table width="200" border="1">
  <tr>
    <td> 
      <iframe src= <?php echo "../SystemDirectory/280610/1.svg"; ?>" width="400" height="250" frameborder="0" scrolling="no"></iframe>
    </td>
  </tr>
</table>

 

The error that i get is:

You don't have permission to access /testing/SystemDirectory/280610/1.svg" on this server.

 

So is this Apache issue or php syntax issue? If this is apache issue then i supposed (i really need a second opinion) i would not have been able to access it right from the first part (without php coding).

Link to comment
Share on other sites

Why echo out all of the image tag?

 

<iframe src="<?php echo $e . $f; ?>" width="400" height="250" frameborder="0" scrolling="no"></iframe>

<?php echo '<iframe src="' . $e . $f . '" width="400" height="250" frameborder="0" scrolling="no"></iframe>";?>

 

A bit cleaner then what you had and should work properly, given that the url is correct.

 

Why should we bother to help, if you cannot take proper solutions and try to implement them and see how / why we did it the way we did?

Link to comment
Share on other sites

Why echo out all of the image tag?

 

<iframe src="<?php echo $e . $f; ?>" width="400" height="250" frameborder="0" scrolling="no"></iframe>

<?php echo '<iframe src="' . $e . $f . '" width="400" height="250" frameborder="0" scrolling="no"></iframe>";?>

 

A bit cleaner then what you had and should work properly, given that the url is correct.

 

Why should we bother to help, if you cannot take proper solutions and try to implement them and see how / why we did it the way we did?

Please refer to my last post:

<table width="200" border="1">
  <tr>
    <td> 
      <iframe src= <?php echo "../SystemDirectory/280610/1.svg"; ?>" width="400" height="250" frameborder="0" scrolling="no"></iframe>
    </td>
  </tr>
</table>

 

And do let me know if that does not follow suggestion from our dear MrAdam... Lolxxx... Cute one premiso  :wtf: ... But i think i managed to sort it out from MrAdam's suggestion... Thanx MrAdam  ;)

Link to comment
Share on other sites

You have invalid HTML, if you notice in mine and Mr. Adam's post we fixed that:

 

<iframe src= <?php echo "../SystemDirectory/280610/1.svg"; ?>"

 

Should be:

<iframe src="<?php echo "../SystemDirectory/280610/1.svg"; ?>"

 

Notice the removal of the extra space and the addition of the quote. But either way you "fixed" it apparently. But from that snippet, it seems as though you ignored our suggestions, at least for the html side of things which we both fixed, which is what I was referring to.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.