Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

php in cell

andreabrauchiandreabrauchi Posts: 5Member
i am wandering why this script doesn't work. i tested the php script on a different page were it wasn't inserted into a table cell.

the $joketext comes from a different page using a hyperlink that takes this value.

is there something special when i want to use it in a table?

thank you in advance:







New Page 1



imageimage







 

 

<?php
echo($joketext);
?>
 




Comments

  • Mark StrijbosMark Strijbos Posts: 82Member
    : i am wandering why this script doesn't work.
    did you save it as a .HTML or a .PHP file?

    and you could try this:

    <?php
    if( isset( $joketext ) )
    echo $joketext;
    else
    echo "No joketext";
    ?>

    this should always render _something_ so if it doesn't you know the
    PHP code doesn't run.



  • andreabrauchiandreabrauchi Posts: 5Member
    The file is saved as .php so this should be fine. i inserted the text you gave to me but there is still nothing in the cell. Maybe there is a problem to insert something into a table cell? when i have the code without the table it is working? maybe i need to rewrite a table cell in php??? this is my first project and i am very lost. i was so excited when i could do this on a plain page and i thought that php can't be that complicated. but i guess it can... thank you for your help.

    andrea

    : : i am wandering why this script doesn't work.
    : did you save it as a .HTML or a .PHP file?
    :
    : and you could try this:
    :
    : <?php
    : if( isset( $joketext ) )
    : echo $joketext;
    : else
    : echo "No joketext";
    : ?>
    :
    : this should always render _something_ so if it doesn't you know the
    : PHP code doesn't run.
    :
    :
    :
    :

  • Mark StrijbosMark Strijbos Posts: 82Member
    : Maybe there is a problem to insert something into a table cell?

    yes, there can be - depending on your browser, the "rendering" of active elements inside a table cell can be very problematic.
    a solution would be to also use php to 'draw' the table; like

    echo '';

    etc etc


Sign In or Register to comment.