PHP alert box for testing?

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23460
  • Loc: Woodbridge VA

Post 3+ Months Ago

Normally in VB I would add a message box alert to test that the value of a variable is what I intended it to be at any given point in a function - something like this:

Code: [ Select ]
MsgBox "The value of strVariable is " strVariable


I would normally search for this, but can somebody quickly tell me the method of doing this with PHP if there is one?
  • Maedhros
  • Proficient
  • Proficient
  • User avatar
  • Posts: 325
  • Loc: Durham, England

Post 3+ Months Ago

I don't think you can do it with an alert box - you'll probably just have to echo it. It works for me, anyway. :)

Edit: Either that, or you can pretend, and use javascript:
PHP Code: [ Select ]
echo "
 
   <script type='text/javascript'>
 
       alert('The variable has the following value: $variable');
 
   </script>
 
";
  1. echo "
  2.  
  3.    <script type='text/javascript'>
  4.  
  5.        alert('The variable has the following value: $variable');
  6.  
  7.    </script>
  8.  
  9. ";
  • Tannu4u
  • Proficient
  • Proficient
  • User avatar
  • Posts: 480
  • Loc: India

Post 3+ Months Ago

Yes u have to use Javascript because php runs on the server side and so it does not have "MsgBox" function, but javascript runs on client side and have "alert" function.
Moderator Remark: removed font color from old ozzu style

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 71 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.