Jump to content

Showing Errors


dudejma

Recommended Posts

I was wondering how to show errors within my template. For example,

 

<?php
$x = $_REQUEST['x'];
$y = $_REQUEST['y'];

if ($x == $y) {
   // Execute code if it works
} else ($x != $y) {
   // Error would be: X did not equal Y. Please correct.
}
?>

 

My question is, how, instead of echoing the error onto a new, blank page, to echo it onto my template. Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/239955-showing-errors/
Share on other sites

I'm very new to PHP but what I'm trying to say is.. Well. Okay, you know how when you echo something, it echos onto a blank white page. Well, I have a template, and I'm wanting the error to echo onto that template. Where would I echo my template and where would I place the error's echo?

Link to comment
https://forums.phpfreaks.com/topic/239955-showing-errors/#findComment-1232624
Share on other sites

Well, for instance. I'm wanting people to fill out a form. And I want, if they left a field blank, for it to say: Blah blah blah. My question is, how would I get it to say Blah blah blah on my template instead of echoing it onto a completely white page.. In other words, WHERE would I echo it to make it onto my template.

 

Ex.

<?php
$x = $_REQUEST['x'];
$y = $_REQUEST['y'];

if (empty($x)) {
   echo "X value was left blank. Please check entry.";
} 
?>

 

I want to know, how can I incorporate my template into this and have the echo inside my template.

Link to comment
https://forums.phpfreaks.com/topic/239955-showing-errors/#findComment-1232629
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.