Jump to content

fopen() and html mix php


dvivarc

Recommended Posts

Hello. First of all sorry for my english....

And I apologize if this topic has appears before but I don´t find it.

 

I explain my problem:

I have a function (fill_div) to put the content of a .html or .php file into a DIV, with xajax:

--- FILL_DIV ---

function Fill_div(){

  $respuesta = new xajaxResponse();

  $fp = fopen ('mifichero.php','r');

  $respuesta = new xajaxResponse();

  $codigo="";

  while ($linea = fgets($fp,1024))

  {

    if ($linea) $codigo .= $linea;

  }

  fclose($fp);

  $respuesta->assign('micapa',"innerHTML",$codigo);

  return $respuesta;

}

 

This function has been tested and it works well if the content of the file .php or .html is only html code:

--- 'mifichero.php' ---  (I tried changing .php to .html and it had the same result)

<form id="form_request" name="form_request" method="post" action="">

  <select name="miselect">

    <option value='value'>myvalue</option>

  </select>

</form>

 

But if the content of that file is html mixing php, it doesn't work:

--- 'mifichero.php' ---

<form id="form_request" name="form_request" method="post" action="">

  <select name="miselect">

    <?php echo "<option value='value'>myvalue</option>"; ?>

  </select>

</form>

 

 

Why? Can anybody help me please????  :confused:    :'(

 

Thank you!

Daniel.

 

Link to comment
https://forums.phpfreaks.com/topic/176179-fopen-and-html-mix-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.