Jump to content

javascript passing through to php


gudfry

Recommended Posts

hi maybe i was in the the wrong area, Sory for convenience,

 

I was looking for a code to test, and i found this code. when I reun it to my browser it has no action happen, i dont know if i was correct. the code is not function well. any idea with this to make the code work?? pls help me.

           

            <?php

msgbox("Are you sure?", "confirm");

$result="";

if ($result == "ok")

    {

    // Perform some "ok" action here...

    }

else

    {

    // Perform some "cancel" action here...

    }

 

  function msgbox($msg, $type)

      {

      if ($type == "alert")

          {

        // Simple alert window

  ?> <script language="JavaScript"> alert("<?php echo $msg; ?>"); </script>

      <?php

        }

      elseif ($type == "confirm")

        {

     

        ?>

          <script language="JavaScript">

          if (confirm("<? echo $msg; ?>"))

                {

                <?php $result == "ok"; ?>

                }

          else

                {

                <?php $result == "cancel"; ?>

                }

          </script>

        <?php

        }

    }

?>

 

 

thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/115350-javascript-passing-through-to-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.