Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.

Display a message with PHP?

Ads
make money online
gamer Offline referral

Posts: 193
Joined: May 2013
Reputation: 4

#1
Member
I know that to show a welcome message, show an error or alert popup JavaScript is needed but is possible to use PHP instead of JavaScript to show welcome message of popup some text? Sorry just started learning PHP code and I need help with this Smile
invisibe_dude Offline referral

Posts: 825
Joined: May 2013
Reputation: 24

#2
Posting Freak
What you are talking about is called PHP echo() Function and it displays a message however to make that message popup you need JavaScript.

Try this:

PHP Code:
if (here goes PHP conditional) {
    echo 
"<script>alert('Correct.');</script>";
} else {
    echo 
"<script>alert('Wrong.');</script>";

seo123 Offline referral

Posts: 426
Joined: Mar 2014
Reputation: 16

#3
Senior Member
I am not a PHP expert but I think you should user PHP error not echo!

PHP Code:
if //something 
{
error("this is an error message");

Ametuniversity Offline referral

Posts: 408
Joined: Feb 2019
Reputation: 0

#4
Senior Member
PHP echo and print Statements. echo and print are more or less the same. They are both used to output data to the screen. The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions.
sinelogixtech Offline referral

Posts: 312
Joined: Mar 2017
Reputation: 1

#5
Senior Member
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;
?>
Ametuniversity Offline referral

Posts: 408
Joined: Feb 2019
Reputation: 0

#6
Senior Member
use this code echo '<script language="javascript">'; echo 'alert("message successfully sent")'; echo '</script>';. The problem was: you missed "; It should be alert



Google this topic


User(s) browsing this thread: 1 Guest(s)