Php Parse Error - Including Variable in post

free web hosting
Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Php Parse Error - Including Variable in post

Raptrex
ok this is my config script that runs my site:

CODE
<?
# Set up info for left column on the top page:
# It should begin with html tag <td> and finish with tag </td>
$top_leftcol="
<td width='195' bgcolor='#eeeeee'  valign='top'>
<table width='100%'  bgcolor='#777799' border=0 cellspacing='0' cellpadding='0'>
<tr><td>
<font FACE='ARIAL, HELVETICA' color='#ffffff' size='-1'>
&nbsp; <b>MMORPG Trade Center</b>
</font>
<TABLE  WIDTH='100%'   border='0' cellspacing='1' cellpadding='4' >
<tr><td bgcolor='#ffffff'>
<font FACE='ARIAL, HELVETICA' color='#000099' size='-1'>
<P ALIGN='JUSTIFY'>
Welcome to MMORPG Trade Center. Please post your in game item only in the correct game section.
</td></tr></table>
</td></tr></table>
<p>
<table width='100%'  bgcolor='#777799' border=0 cellspacing='0' cellpadding='0'>
<tr><td>
<font FACE='ARIAL, HELVETICA' color='#ffffff' size='-1'>
&nbsp;<b>News</b>
</font>
<TABLE  WIDTH='100%'   border='0' cellspacing='1' cellpadding='4' >
<tr><td bgcolor='#ffffff'>
<font FACE='ARIAL, HELVETICA' color='#000099' size='-1'>
News Goes Here
<P ALIGN='JUSTIFY'>
</font>
</td></tr></table>
</td></tr></table>
<p>
<table width='100%'  bgcolor='#777799' border=0 cellspacing='0' cellpadding='0'>
<tr><td>
<font FACE='ARIAL, HELVETICA' color='#ffffffff' size='-1'>
&nbsp;<b>Other</b>
</font>
<TABLE  WIDTH='100%'   border='0' cellspacing='1' cellpadding='4' >
<tr><td bgcolor='#ffffff'>
<font FACE='ARIAL, HELVETICA' color='#000099' size='-1'>
<P ALIGN='JUSTIFY'>
Other Links Goes Here
</font>
</td></tr></table>
</td></tr></table>
</td>
";
?>


acutally i didnt write this but heres my problem

CODE
<font FACE='ARIAL, HELVETICA' color='#000099' size='-1'>
News Goes Here
<P ALIGN='JUSTIFY'>


where is says "News goes here" how can i add php to include a file cuz i get this error

CODE
Parse error: parse error, unexpected T_STRING in /home/raptrex/public_html/trade/config.php on line 215


when i add that
<?php include "showonline.php"; ?>

i tried taking out the <?php ?> tags

and i still get the parse error

plz help

 

 

 


Reply

bjrn
Okay, you tried putting <?php stuff ?> inside a string. So if you wanted to include output from a script you'd have to do something like:
CODE
<?php
$string="things".(include('showonline.php'))."more things";
?>

instead of
CODE
<?php
$string="things <?php include('showonline.php'); ?>."more things";
?>


Secondly, you seem to have spotted the problem yourself, whether or not you try to include showonline.php, you still get an error. In fact, no matter what you do, you get an error in config.php. Clearly the error lies in config.php.

So, I suggest you check where line 215 would be and see what you are doing there. It might be that you have to escape quotation marks or something like that. Try replacing all ' with \"

Reply

electriic ink
It is not possible to have include ""; inside a variable. One way you could still have this is by using a function() instead.

I am going to create a function called top_leftool to replace your variable $top_leftool. Now instead of writing $top_leftool when you write this text just write top_leftool() instead!

Here is the code:

CODE

<?
// Set up info for left column on the top page:
// It should begin with html tag <td> and finish with tag </td>

function top_leftool() {

echo "<td width='195' bgcolor='#eeeeee'  valign='top'>
<table width='100%'  bgcolor='#777799' border=0 cellspacing='0' cellpadding='0'>
<tr><td>
<font FACE='ARIAL, HELVETICA' color='#ffffff' size='-1'>
&nbsp; <b>MMORPG Trade Center</b>
</font>
<TABLE  WIDTH='100%'   border='0' cellspacing='1' cellpadding='4' >
<tr><td bgcolor='#ffffff'>
<font FACE='ARIAL, HELVETICA' color='#000099' size='-1'>
<P ALIGN='JUSTIFY'>
Welcome to MMORPG Trade Center. Please post your in game item only in the correct game section.
</td></tr></table>
</td></tr></table>
<p>
<table width='100%'  bgcolor='#777799' border=0 cellspacing='0' cellpadding='0'>
<tr><td>
<font FACE='ARIAL, HELVETICA' color='#ffffff' size='-1'>
&nbsp;<b>News</b>
</font>
<TABLE  WIDTH='100%'   border='0' cellspacing='1' cellpadding='4' >
<tr><td bgcolor='#ffffff'>
<font FACE='ARIAL, HELVETICA' color='#000099' size='-1'> ";

/* Now lets stop writing the first part and INCLUDE the news */

include "showonline.php";

/* Great, we've included the news so lets carry of writing! */

echo "<P ALIGN='JUSTIFY'>
</font>
</td></tr></table>
</td></tr></table>
<p>
<table width='100%'  bgcolor='#777799' border=0 cellspacing='0' cellpadding='0'>
<tr><td>
<font FACE='ARIAL, HELVETICA' color='#ffffffff' size='-1'>
&nbsp;<b>Other</b>
</font>
<TABLE  WIDTH='100%'   border='0' cellspacing='1' cellpadding='4' >
<tr><td bgcolor='#ffffff'>
<font FACE='ARIAL, HELVETICA' color='#000099' size='-1'>
<P ALIGN='JUSTIFY'>
Other Links Goes Here
</font>
</td></tr></table>
</td></tr></table>
</td>
";

} /* End the function */

?>


That should be it. Just right top_leftool() where you want the news to go smile.gif

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : php parse error including variable

  1. Mysql Error - (3)
  2. Parse: Error Unexpected T_lnumber - php parse error when running script (4)
    Hi. I've just created a php script. The main object of the script is to delete some old files
    and replace it with a new file with some new content, effectively moving the contents from one file
    to another. These are the first 50 lines of the file: /* Calculate For The "A" Group - The
    Latest Games ID */ $a_B = 002; while(file_exists("a_" . $a_B . ".dat")) {
    $a_B++; } $new_page_contents = " " . $_POST . " " . $_POST . "
    include \"/home/cmatcme/public_html/footer.php\"; ?> "; $a_stream = fopen(&...
  3. Unexpected T_variable... - Help! (3)
    I did construct the database connection file which is called "config.php". But, I got some mistake
    that has to be solved to continue with working. This is the code itself: //Set the database
    values $confg ="alex1985_admin" //Your database username $confg ="" //Your database
    user's password $confg ="localhost" //Your host $confg ="books" //Your database name
    //Create the function to log into the DB function db_login() { global $confg; $link =
    @mysql_connect($confg , $confg , $confg ) or die("Error connecting: " . mysql...
  4. Script Help Required: Undefined Variable - A fault I cannot spot in PHP (3)
    Hi, when running a PHP script I keep getting the error: QUOTE Notice: Undefined variable: bret
    in c:\program files\easyphp1-8\home\poll.php on line 294 Notice: Undefined
    variable: bret in c:\program files\easyphp1-8\home\poll.php on line 294 (And,
    yes, I get it twice). The code related to the variable is as follows: CODE function
    LogString($string,$type)     {         $t_log = "\n";
            $t_log .=
    $this->globaldata->server_vars['REMOTE_ADDR']."...
  5. Php Objects: Catchable Fatal Error - There is a weird problem with objects in php 5.2.2 (4)
    in php 4.4.7 my code seems to be ok but in later version 5.2.2 i get this error Catchable fatal
    error: Object of class mission_rank could not be converted to string in
    /Applications/xampp/xamppfiles/htdocs/nexus/includes/forms/cn_reload.php on line 41 cn_reload.php
    include('../class/userClass.php'); session_start(); $app_user =&
    $_SESSION ; if ($app_user->character != false) { $race_letter =
    array('H','E','T','M','G'); $cn_id = 0; foreach
    ($app_user->character as...
  6. Getting An Array Value Of A Dynamic Variable - (9)
    Ok i can't believe I need help in php but I can't figure this out... If i have an array,
    lets say called test, how do i get a certain value from that array when referencing it dynamically
    by either a string or another variable? Example: CODE $test=array(1,2,5);
    $name="test"; //Doesn't work: echo $$name[0]; /Doesn't
    work: echo ${$name}[0]; ...
  7. T_string Error Please Assist - (5)
    I have unexpected t_strings in 3 lines they are CODE <?php // $Header$ //this
    script may only be included - so its better to die if called directly. if
    (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !==
    false) {   header("location: index.php");   exit; } /* A basic library to
    handle a cache of some Tiki Objects, usage is simple and feel free to improve it */ class Cachelib
    {   var $folder;   function Cachelib() {         global $tikidomain;
            $th...
  8. Phpbb2 Error - recently showing up (4)
    I tried to install a mod. Did it successfully but didn't like the end result. So I went through
    the install backwards and reverted everything back to how they were. Now I am getting this error.
    QUOTE Warning: Cannot modify header information - headers already sent by (output started at
    /home/damen/public_html/phpBB/language/lang_english/lang_main.php:1034) in
    /home/damen/public_html/phpBB/includes/page_header.php on line 483 Warning: Cannot modify header
    information - headers already sent by (output started at
    /home/damen/public_html/phpBB/language/lang_english...
  9. Php Fsockopen() Error - (14)
    Hi guys, I've been having problems with PHP and my Apache server, I've got this book (SAMS
    PHP, MYSQL and Apache All in One) I've installed all services correctly, but I get an error on
    my Radio Homepage saying: QUOTE Warning: fsockopen() : unable to connect to 5.106.1.74:8000 (A
    non-blocking socket operation could not be completed immediately. ) in C:\Program
    Files\Apache Group\Apache2\htdocs\radio\stats\radio_stats.php on line
    13 Riphabbo Radio Is Currently Offline I'm new to PHP and would like to know if th...
  10. Error On Emailer.php & Smtp.php At Phpbb - ERROR on emailer.php & smtp.php at PhpBB (2)
    Are you use free webhosting??? smtp.php and emailer.php are general error on CMS like phpBB . It
    make email verification disabled.Why??? because free webhosting not allow us use smtp port .they
    afraid their server will atacking with spam !! so what solution to solve this problem?? You
    can search on google or join at phpBB forum !!! but if it can not solve all this problem
    it only able 1 trick ..you must download emailer MOD at www.phpbbhacks.com to inactive emailer.php
    or smtp.php ...
  11. Error With Joomla Template - cant find function (1)
    Hello! I am working on my template in Dreamweaver and i am using joomla extensions for
    dreamweaver! When i start my page with joomla stand alone server(jsas) i get this errors on the
    bottom of the page! QUOTE Warning:
    mosloadcomponent(w:/www/Joomla/components/com_banner/banner.php) : failed to open stream: No such
    file or directory in w:\www\Joomla\includes\frontend.php on line 66 Warning:
    mosloadcomponent(w:/www/Joomla/components/com_banner/banner.php) : failed to open stream: No such
    file or directory in w:\www\Joomla�...
  12. Php Help Needed Including File In A Page. - (2)
    i'm a noob in php programming, i can understand and modify php programs, but i dont know to
    write on my own. So please somebody who is well versed in php help me. My need is, I'm
    currently builiding a knowledge base website , i've my own design for the website, check here,
    http://laschatz.info/kzone/ Each page in the left hand site has a tree navigation of all the
    topics available. Since this information must be same in all the pages, presently I need to change
    all the pages after adding a new category. Could you please help me in such a way that I can ad...
  13. Uglymonkey Toplist Script - Getting an error with this script, please help. (7)
    I'm getting an error on the index page.Need help to fix it please. There's the error:
    CODE Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
    resource in /home/chatz/public_html/top/index.php on line 10 Failed: delete from
    uglymonkey_toplist where lastin < '2006-07-28 18:23:19' and total='0'
    Here's the index page that I'm getting the error on: CODE <?php
    include("config.php"); if ($purgedays>0){     $purgeseconds =
    $purged...
  14. [forum] Double Posting Happening By An Error - (3)
    Hello, I am currently working on EvilBoard 0.1.1, for those who know about this project versjon 0.1b
    can be downloaded from http://www.evilservices.com Well over to the reason why i am posting this,
    I am currently experincing a problem with my new posting code wich has been rewrited in version
    0.1.1, You see, it is double posting by an error, i thouht i could fix that myself, but no, so i
    just thought, Trap17 is perfect, they problety know how to fix this, Here is the code: CODE
    <? /* * @Name: Post Topic * @Author: Arne-Christian Blystad * @Copyright&...
  15. Error Importing Sql Query Via Php - Works in PHPmyAdmin (6)
    CODE     function sql()     {         $fp =
    fopen("sql.sql","r");         $sql =
    fread($fp,filesize("sql.sql"));         fclose($fp);
            return $sql;     } Thats $this->sql and here is the other source CODE
    function insert_sql()     {     if($_GET['insert'])  {
            $template = new template;         $db = new db;
            $db->connect();         $query = $this->sql();       ...
  16. Help Needed With Silly Error - (8)
    Hi i have made a stupid error on one of my pages and having trouble finding it. It says unexpected
    ')' on line 114 can anyone please help me find it? Here is the page: CODE <? /** *
    * @package TibiaME Clan/Download Site * @version 1.00 2006/09/27 00:04:37 wappy * @copyright
    (c)2004-2006 wappyCULT * @home http://hack.s-60.org * @license You can use/modify this
    script but distributing it without permisinn, or removing the "Script By: wappy" link
    will invalidate your license and give wappy (wappyCULT) FULL RIGHTS to ...
  17. Detect Image Resolution Without Gd - Also stop error if not found (1)
    Hi, I have come accross some starnge problem in PHP. I wanted to detect the image resolution in
    of a URL specified by the user. This is possible via getimagesize() function of PHP that is
    independent of GD library. But this function generates a E_WARNING Error if the image is not there.
    What shall i do to stop this warning ?? I dont want to show the Error in PHP style but my style of
    error reporting. Please help me....
  18. Freetype, Gd And An Error - I just can't get FreeType to work (1)
    Basically I have this code: CODE header("Content-type: image/png");
    $bgimg = "bg.png"; $im = imagecreatefrompng($bgimg); $number =
    rand(10,99); $textcolour = imagecolorallocate($im, 255, 255, 255);
    $font = "arial.ttf"; imagettftext($im, 65, 0, 5, 95, $textcolour,
    $font, $number); imagepng($im); imagedestroy($im);
    Unfortunately all I get is the blank placeholder for an image (or the red X if you still use IE)
    rathe...
  19. Php Form Help! - Parse error T_LNUMBER - expecting T_VARIABLE (3)
    Hello, I am trying to make an employee application. I was just wondering if anyone knows how to spot
    a php code error, when the code directly around the line with the error looks the same. below is
    some of my process.php code. I beleive the error is on line 41. QUOTE PHP parse error: PHP
    Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in
    /home/wwwange/public_html/FORMS/forms/process.php on line 41 Process.php code: CODE
    <?php include("global.inc.php"); $errors=0; $error="The foll...
  20. Converting Characters In A Variable To Individual Values In An Array - turning variables into arrays (2)
    Say I have a variable such as $nav_item and it had to contents Home . IE: CODE
    $nav_item = 'Home'; How would I make so that $nav_item was an array and
    had the following contents? CODE $nav_item = array ('h', 'o',
    'm', 'e'); With the case changing (ie H would become h and U
    would become u ) EDIT: Okay found out that I could change the case with
    array_change_key_case ($nav_item, CASE_LOWER); ...
  21. <textarea> Tag Is Not Accepting Php Variable - for display, although <Input> tag does accept it (2)
    I have a single page template which has a Form on it. Logic is to check for a valid Querystring and
    place the variables accepted from a form back into the form and re-display this form with error or
    acceptance messages. I'm sure everyone here has done this a million times. The Form accepts
    data from a user for First name, Last name, email address, and message-body named
    'note_wide' then re-displays the values into the Form, but for some reason, I can't get
    the value to display into a Textarea. Sample of the php code is as follows: first the good one:...
  22. Php Error When Running Script - Php error when running script (3)
    Hello, I get the following error: Parse error: syntax error, unexpected T_STRING in
    /usr/local/psa/home/vhosts/club-amigos.co.uk/httpdocs/contact.php on line 44 when l run the
    following script: Any help would be appreciated. CODE <?php /* PHP Form Mailer -
    phpFormMailer v2.1, last updated 30th Nov 2005 - check back often for updates! (easy to use
    and more secure than many cgi form mailers) FREE from: www.TheDemoSite.co.uk Should work
    fine on most Unix/Linux platforms */ // ------- three variables you MUST change below
    -------------...
  23. Suppressing Mysql Error In Php - How to suppress auto generated mysql err (4)
    I am testing my website on my local machine. It is still in development stage and I am using
    php/mysql. If there is a mysql connection error, I am checking for the connection variable and
    displaying a proper error message. But even before it displays my error message, it displays an
    error message on browser thrown by mysql (MySQL Connection Failed: Access denied for user). Can I
    suppress this message and display only my message?...
  24. Phpbb Install Error - help w/ phpbb plz.... (2)
    ok, i type in eveything that phpbbb asked to install, and i use the info i got in the mail and made
    a db, but it doesn't work at all.......instaed it says "An error occurred trying to update the
    database You have an error in your SQL syntax; check the manual that corresponds to your MySQL
    server version for the right syntax to use near ''' at line 1" what does this mean and
    how do i fix this and install the forum?? i have tried to install this many times now but it never
    works /sad.gif' border='0' style='vertical-align:middle' alt='sad.gif' /> .....
  25. Parse Error - unexpected $ (1)
    i have this code CODE <?php if($_POST['user']=="" or
    $_POST['pass']=="" or $_POST['host']==""
    or $_POST['root']=="" or
    !isset($_POST['run'])){  print('<form method=post
    name=form>');  print('FTP username <input type=\'text\'
    name=user value=""><br>');  print('FTP password <input
    type=\'password\...
  26. Validation Error No Insert - (3)
    im having some trouble with this PHP Code: CODE while ($checking =
    mysql_fetch_array($check)){            $usr =
    $checking['loguser'];            $mail =
    $checking['logemail'];                                $error =
    "";                                            if ($mail == $email){  
                         $erroremail = "the email address you have chose is already taken";
                           $error = 1;                        }...
  27. Weird Error Messages In Opera - (2)
    On the bottom of my site, I get weird error messages, but only in Opera (Not firefox or IE). The
    messages appears below the last include tag on my site, so they appear on the bottom of the page. I
    get two different messages: QUOTE ETag: "9e80b2- HTTP/1Date: Fri, 02 Sep 2005 11:48:28 GMT
    Server: Apache/2.0.52 (Unix) Connection: Keep-Alive Keep-Alive: timeout=1, max=98 ETag:
    "4b94ff-40c5-98ed0bc0" HTTP/1.1 200 OK Date: Fri, 02 Sep 2005 11:48:28 GMT Server: Apache/2.0.52
    (Unix) Last-Modified: Fri, 02 Sep 2005 11:48:26 GMT ETag: "4b9516-1be2-8a1f9680" Accept-Ranges: by...
  28. Error When Using file_put_contents() - failed to call to undefined function (4)
    Hey all, I decided to write a script which writes some text to a file, but I have a problem when I
    execute the script, I get a fatal error: QUOTE(homepage) Fatal error : Call to undefined
    function: file_put_contents() in /home/cmatcme/public_html/afile.php on line 55 This is the
    code I'm using to write the file: $ipfnsdoc =
    "/home/cmatcme/public_html/afolder/afile.txt"; if (!is_readable($ipfnsdoc)) {
    echo "File cannot be read"; $stopload = 1; } if (!is_writable($ipfnsdoc)) {
    echo " \nFile can...
  29. Determining Whether A Phrase Is In A Variable - deciding whether a string is a url (2)
    I have a input box in a form called "button" and when the user clicks Submit! I want php to
    determine whether or not this is a url or just text. All urls have "http://" in them so I have
    decided I need a script which can determine whether or not "http://" is in a variable or a string.
    The problem with using strings is that I've never needed to use them before (and thus have no
    knowledge about them). When I was using asp, I knew there was a function called instr() but I
    can't find php's equivalent. Does anybody know? Thanks in advance!...
  30. Trouble With Emailer.php - failed sending email error (5)
    Whenever someone registers at my forum, they get this error: Failed sending email :: PHP :: DEBUG
    MODE Line : 234 File : emailer.php however, the account will be sucessfully registered. It is
    weird because i did not change the original emailer.php at all. O__O||| anyone know whats up with
    it?...



Looking for php, parse, error, including, variable, post

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for php, parse, error, including, variable, post

*MORE FROM TRAP17.COM*
Mysql Error
Parse: Error
Unexpected
T_lnumber
php parse
error when
running
script
Unexpected
T_variable..
. Help!
Script Help
Required:
Undefined
Variable A
fault I
cannot spot
in PHP
Php Objects:
Catchable
Fatal Error
There is a
weird
problem with
objects in
php 5.2.2
Getting An
Array Value
Of A Dynamic
Variable
T_string
Error
Please
Assist
Phpbb2 Error
recently
showing up
Php
Fsockopen()
Error
Error On
Emailer.php
&
Smtp.php At
Phpbb ERROR
on
emailer.php
&
smtp.php at
PhpBB
Error With
Joomla
Template
cant find
function
Php Help
Needed
Including
File In A
Page.
Uglymonkey
Toplist
Script
Getting an
error with
this script,
please help.
[forum]
Double
Posting
Happening By
An Error
Error
Importing
Sql Query
Via Php
Works in
PHPmyAdmin
Help Needed
With Silly
Error
Detect Image
Resolution
Without Gd
Also stop
error if not
found
Freetype, Gd
And An Error
I just
can't
get FreeType
to work
Php Form
Help!
Parse error
T_LNUMBER -
expecting
T_VARIABLE
Converting
Characters
In A
Variable To
Individual
Values In An
Array
turning
variables
into arrays
<textarea
> Tag Is
Not
Accepting
Php Variable
for display,
although
<Input>
; tag does
accept it
Php Error
When Running
Script Php
error when
running
script
Suppressing
Mysql Error
In Php How
to suppress
auto
generated
mysql err
Phpbb
Install
Error help
w/ phpbb
plz....
Parse Error
unexpected
$
Validation
Error No
Insert
Weird Error
Messages In
Opera
Error When
Using
file_put_con
tents()
failed to
call to
undefined
function
Determining
Whether A
Phrase Is In
A Variable
deciding
whether a
string is a
url
Trouble With
Emailer.php
failed
sending
email error
advertisement



Php Parse Error - Including Variable in post



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE