Jump to content

include problem


klepec

Recommended Posts

I have a code where i include file (on submit).

 

if isset(...

include "example.php";

 

This example.php contains a variable $message which i later print in original code.

 

How do i prevent getting undefined variable errors? (before submit button is pressed)

 

Thanks

 

Link to comment
Share on other sites

you can use the default value

for example

$message = "you default value";

include("some_process_file_that_change_behavior_of_message_var.php");

//follow you code check here

 

It's another option but then your blinded as to what's happening to $message. Its only a work around not a practical solution in my opinion.

hope it help

Link to comment
Share on other sites

I know :/ ... i do includes whenever i operate with the databases and forms.

For example, there is a user form for storing company information and few company images.

 

In original file i usually do the html (form), and submit button isset condition (PHP).

In included file (PHP only) i operate with post variables, create thumbnails, save images, insert to database, select from database.... etc

 

Then back in original file I usually print out database results, messages etc.

 

 

 

 

Link to comment
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.