Jump to content

Recommended Posts

Hi Im not sure if "includes" would be the solution to this but I need to include a piece of php code inside

 

a tab in a nother page.

 

this is the php code sample:

 

<td class="grid">
<p>Additional Administrator Login</p>
</td>
<td class="grid">
<p>Username <input type="text" name="admin_username" value="<?php echo $userXML[0]["username"]; ?>" /></p>
<p>Password <input type="text" name="admin_password" value="<?php echo $userXML[0]["password"]; ?>" /></p>
</td>
</tr>

 

 

 

the php code comes from the same domain. Any help would be appreciated, I've been at this for days now.

If you want just to insert the same piece of code, there's a different solutions:

  • Includes from another file *.php (recommended, most easiest)
  • Selection from Data Base: MySQL or others (most hardest way)
  • Storage Classes. Note: OOP required (you're creating class and storing inside of class piece of code)

hi and thank you both for your responces. I'm just starting to learn php so some of your suggestion maybe alien to me still. Any code samples would

 

go along way and hugely appreciated.

 

Regarding the "include" i already tried including the the php page with the tab and it wont shot up. the script that creates the tabs came wih an an example of how to include your own php pages i just edited the code to add my php page and it wont show up.

 

But even if i can get it to show up I'm just looking to display only a portion of that php page.

 

this is the include code that I used:

 

 

<?php include($DOCUMENT_ROOT . "/admin/inc/settings.php"); ?>

 

 

and i get this error:

 

 

 

Notice: Undefined variable: DOCUMENT_ROOT in C:\Program Files\EasyPHP-12.1\www\examples\innertabs.php on line 1

Warning: include(/admin/inc/settings.php): failed to open stream: No such file or directory in C:\Program Files\EasyPHP-12.1\www\examples\innertabs.php on line 1

Warning: include(): Failed opening '/admin/inc/settings.php' for inclusion (include_path='.;C:\php\pear') in C:\Program Files\EasyPHP-12.1\www\examples\innertabs.php on line 1

 

 

Im working localy by the way.

 

Thanks again.

Please do not store your code in a database - that should never be done.

You can either include the file, or create a function which generates that section.

 

+1 Jessica, never store code in data bases, and never (sometimes yes, but only at home!) don't use eval()s in code!

But it was only a option, just option. It's one way of storing code, but bad way :lol:

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.