How to show an alert box in PHP

0 votes

I want to display an alert box showing a message with PHP.

Here is my PHP code:

<?php  
  header("Location:form.php");

  echo '<script language="javascript">';
  echo 'alert(message successfully sent)';  //not showing an alert box.
  echo '</script>';
  exit;
?>

But it is not working.

Nov 4, 2020 in PHP by kartik
• 37,520 points
4,800 views

1 answer to this question.

0 votes

Hello,

use this code

echo '<script language="javascript">';
echo 'alert("message successfully sent")';
echo '</script>';

The problem was:

  1. you missed "
  2. It should be alert not alery
Hope it helps!!
answered Nov 4, 2020 by Niroj
• 82,840 points

Related Questions In PHP

0 votes
0 answers

How to pop an alert message box using PHP?

How to pop an alert message box ...READ MORE

Jun 3, 2022 in PHP by Kichu
• 19,040 points
478 views
0 votes
1 answer

How to check an IP address is within a range of two IPs in PHP?

Hello @kartik, With ip2long() it's easy to convert your addresses ...READ MORE

answered Nov 3, 2020 in PHP by Niroj
• 82,840 points
3,641 views
0 votes
1 answer

How to matching an IP to a CIDR mask in PHP 5?

Hello @kartik, If only using IPv4: use ip2long() to convert the ...READ MORE

answered Nov 6, 2020 in PHP by Niroj
• 82,840 points
3,192 views
0 votes
1 answer

How to pass an array via $_GET in php?

Hii, You can pass an associative array to http_build_query() and ...READ MORE

answered Nov 22, 2020 in PHP by Niroj
• 82,840 points
4,510 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,085 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
3,017 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,950 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
44,892 views
0 votes
1 answer

How to remove duplicate values from an array in PHP?

Hello @kartik, Use array_unique(): Example: $array = array(1, 2, 2, 3); $array ...READ MORE

answered Sep 15, 2020 in PHP by Niroj
• 82,840 points
2,749 views
0 votes
1 answer

How to check if a string is an email address in PHP?

Hello, Try this without regular expressions: <?php ...READ MORE

answered Nov 3, 2020 in PHP by Niroj
• 82,840 points
4,003 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP