Results 1 to 8 of 8
  1. #1
    Join Date
    Jun 2008
    Location
    pakistan
    Posts
    109

    Unanswered: html publish problem!

    i have a problem in php i want to publish html coding
    suppose if i write like this
    <?php
    echo "<html>";
    it will write this coding on preview
    like this
    <html>
    because i am making a generator so it's necessory that it will write this

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    look at using escape characters IIRC its \< \> in php
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jun 2008
    Location
    pakistan
    Posts
    109
    Quote Originally Posted by healdem
    look at using escape characters IIRC its \< \> in php
    please tell me briefly because i am new in this plese

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    use an escape character (IIRC its \ in PHP) to precede the character you want displaying as is

    eg to display a " use \"
    a < use \<
    a > use \>

    PHP: Strings - Manual
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jun 2008
    Location
    pakistan
    Posts
    109
    <form name="form1" method="post" action="index2.php">
    <table width="352" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td width="137" height="26" bgcolor="#CCCCCC"><div align="left"><span class="style1">Window Name</span></div></td>
    <td width="205" bgcolor="#CCCCCC"><input name="fn" type="text" id="fn" size="30"></td>
    </tr>
    <tr>
    <td height="26" bgcolor="#CCCCCC"><div align="left"><span class="style1">Song Title</span></div></td>
    <td bgcolor="#CCCCCC"><input name="st" type="text" id="st" size="30"></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC"><div align="left"><span class="style1">Song Link </span></div></td>
    <td rowspan="2" bgcolor="#CCCCCC"><input name="sl" type="text" id="sl" size="30"></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC"><input type="submit" name="Submit" value="Submit">
    <input type="reset" name="Submit2" value="Reset"></td>
    </tr>
    </table>
    </form>

  6. #6
    Join Date
    Jun 2008
    Location
    pakistan
    Posts
    109
    <?php
    $fn1=$_POST['fn'];
    $st1=$_POST['st'];
    $sl1=$_POST['sl'];
    $myfile="file.html";
    $fh=fopen($myfile,'w');
    $string=$fn1.$st1.$sl1;
    Fwrite($fh,$string);
    fclose($fh);
    ?>

  7. #7
    Join Date
    Jun 2008
    Location
    pakistan
    Posts
    109
    i have a form that you see above coding and i have this php script i want to know more about scape character bcoz i am new in php and this type of matter i want to make a coding generator that generate coding of html
    suppose i have declare another variable $coding and give it coding <html>and in the center of coding i write that it add form input like song title which i show in form can i do that that it will generate coding if you couldn't understand i will post that whole method tommorow if you say

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    echo "\"\<html\>\"";
    or
    $coding = "\"\<html\>\"";
    have a look at ythe function htmlentities and htmlspecialchars functions in PHP
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •