Moving variable form Javascript to PHP?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Otto Haldi

    #1

    Moving variable form Javascript to PHP?

    Hello to all,

    I just downloaded the cross-browser rich text editor from
    Kevin Roth. http://www.kevinroth.com/rte/demo.htm

    Sample fo the html code:
    <script language="JavaS cript" type="text/javascript">
    <!--
    function submitForm() {
    //call updateMessage to
    updateRTE();
    alert(document. RichTextEditor. msgbody.value);

    //change the following line to true to submit form
    return true;
    }
    //-->
    </script>

    The code shown a pop up alert box!

    I'm not using javascript, but I like to know, how can I get
    the value in a PHP $variable to save It in a MySQL table.

    Many thanks in advance for your help.

    Thanks.

    Otto



  • jn

    #2
    Re: Moving variable form Javascript to PHP?


    "Otto Haldi" <ohaldi@freesur f.ch> wrote in message
    news:VA.0000017 4.006e6412@free surf.ch...[color=blue]
    > Hello to all,
    >
    > I just downloaded the cross-browser rich text editor from
    > Kevin Roth. http://www.kevinroth.com/rte/demo.htm
    >
    > Sample fo the html code:
    > <script language="JavaS cript" type="text/javascript">
    > <!--
    > function submitForm() {
    > //call updateMessage to
    > updateRTE();
    > alert(document. RichTextEditor. msgbody.value);
    >
    > //change the following line to true to submit form
    > return true;
    > }
    > //-->
    > </script>
    >
    > The code shown a pop up alert box!
    >
    > I'm not using javascript, but I like to know, how can I get
    > the value in a PHP $variable to save It in a MySQL table.
    >
    > Many thanks in advance for your help.
    >
    > Thanks.
    >
    > Otto
    >[/color]

    Change the form action to a PHP script that will handle your input. Take out
    the "alert" line in the javascript. When you submit the form, the variable
    will be passed to your PHP script in the post array as $_POST['msgbody']

    HTH


    Comment

    • Otto Haldi

      #3
      Re: Moving variable form Javascript to PHP?

      Many thanks four your quick answer.
      [color=blue]
      > Change the form action to a PHP script that will handle your input. Take out
      > the "alert" line in the javascript. When you submit the form, the variable
      > will be passed to your PHP script in the post array as $_POST['msgbody']
      >[/color]

      I still have a small question, witch variable should I read in
      $_POST['msgbody']?

      Here the all form:
      <form name="RichTextE ditor" action="" method="post" onsubmit="retur n
      submitForm();">
      <?php include "includes/rte.php"; LoadRTE("msgbod y", $sContent, "", "", true);
      ?>

      <script language="JavaS cript" type="text/javascript">
      <!--
      function submitForm() {
      //call updateMessage to
      updateRTE();
      // alert(document. RichTextEditor. msgbody.value);
      return true;
      }
      //-->
      </script>

      <p><input type="submit" name="submit" value="Enregist rer"></p>
      </form>

      Regards

      Otto

      Comment

      Working...