How to pass a value in Javascript to a value in php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jiing.deng@gmail.com

    How to pass a value in Javascript to a value in php

    I have not learned Javascript,just copy & paste & revise

    <script language="JavaS cript">
    function confirmDelete{
    re = confirm("Delete or not?(yes,cancel )");
    if (re == "0"){<?php $re1 = 0;?>}else{ <?php $re1 = 1;?>}
    <!--the upper line will cause the confirm windows disappearing--!>
    return 0;
    }
    document.writel n(confirmDelete ());
    </script>
    <?php
    echo "\$re1 = $re1";
    ?>


    1. How to pass the value "re" in Javascript to $re1 in php
    2. How to revise to make the confirm window appear and pass the value
    correctl

    thanks in advanced.
    -jiing-

  • Colin McKinnon

    #2
    Re: How to pass a value in Javascript to a value in php

    jiing.deng@gmai l.com wrote:
    [color=blue]
    > I have not learned Javascript,just copy & paste & revise
    >
    > <script language="JavaS cript">
    > function confirmDelete{[/color]
    <snip yucky javascript>[color=blue]
    >
    > 1. How to pass the value "re" in Javascript to $re1 in php
    > 2. How to revise to make the confirm window appear and pass the value
    > correctl
    >[/color]

    Put a form on your page with a input field called 're' and set the value,
    then submit the form from javascript. Or use an iframe/popup.

    C.

    Comment

    Working...