Hey all,

I have created a mail script in PHP for a contact form on my website. I have a message that displays when the message has been sent. I would like this message to display below my form but am having some trouble with this. The message is currently being displayed at the very top of my page. Here is what I have;

<?php
//mail form code here
$variable = 'some text';
?>

<html>
<head>
<body>
blah 
blah 
blah

<?php echo $variable; ?>

blah
blah
blah

This gives me an error saying that the variable does not exist. I am guessing that this has something to do with th scope of the variable but was wondering how I could do what I am trying. Thanks

Check previous code that you don't posted. Maybe there is a conditional statement in the mail block code, which includes $variable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.