Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.