I'm new and i would like some help please.

Discussion in 'PHP' started by cip6791, Nov 8, 2007.

  1. #1
    I would like to call a javascript using php using a textarea and a submit button.

    index.php
    <form action="ad.php" method="post">
    <p>
    <textarea name="ad" rows="4" cols="45"></textarea>
    </p>
    <p><input type="submit" value="Update" /></p>
    </form>
    -------------------------------------------------------
    ad.php
    <?php

    $ad = $_POST["ad"];
    //$temp = "<b>fds</b>";

    echo ($ad);

    ?>

    when i paste a little javascript, let s say my google adsense script ... the php won t display it. Why? Can anybody help?


    Thanks
     
    cip6791, Nov 8, 2007 IP
  2. CEHonline

    CEHonline Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    index.php
    <form action="ad.php" method="post">
    <p>
    <textarea name="ad" rows="4" cols="45"></textarea>
    </p>
    <p><input type="submit" value="Update" /></p>
    </form>
    -------------------------------------------------------
    ad.php
    <?php

    $advertisment = $_POST["ad"];

    echo $advertisment;

    ?>
     
    CEHonline, Nov 9, 2007 IP
  3. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #3
    what do you want to call from javascript??

    you can write a javascript event, and call functions inside php..
    onclick, onblur, etc..

    here is my quick example script
    
    <head>
    <title>Untitled Document</title>
    <script type="text/javascript">
    function trial()
    {
    	alert("ryan");
    }
    </script>
    </head>
    
    <body>
    </body>
    </html>
    
    HTML:
    
    <?php
    echo"<form id=\"form1\" name=\"form1\" method=\"post\" >
      <label>
      <input type=\"submit\" name=\"Submit\" value=\"Submit\" onclick=\"trial()\"/>
      </label>
    </form>";
    ?>
    PHP:
     
    bartolay13, Nov 9, 2007 IP