Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 06-16-2005, 12:09 AM Parse error help...
Junior Talker

Posts: 3
Trades: 0
g'day all,

new to the site and w/lamp... right, here's the dilema.. when i run the script below i get parse error on line 138... that has the </html> on it, thats it... any help is appreciated...


PHP Code:
<?php

IF ($_POST['submit'] == 'Submit')
{
  IF (!
$_POST['content'])
    {
    
$message '<p>You have not entered any content.</p>';
    }
  IF (!
$_POST['page'])
    {
    
$message '<p>Please choose a location for the content.</p>';
    }
}
    ELSE
{
    
//Open connection to DB
    
require_once "../$data_path"data/mysql_connect.php";

    
//Insert content to DB
    
$as_date addslashes($_POST['date']);
    
$tr_date trim($as_date);
    
$as_page addslashes($_POST['page']);
    
$tr_page trim($as_page);
    
$as_title addslashes($_POST['title']);
    
$tr_title trim($as_title);
    
$as_content addslashes($_POST['content']);
    
$tr_content trim($as_content);
    
$query "INSERT INTO content (content_id, date, page, title, content)
          VALUES(NULL, '
$tr_date', '$tr_page', '$tr_title', '$tr_content')";
    
$result mysql_query($query);
    IF (
mysql_affected_rows() == 1)
    {
      
$message '<p>The site has been updated!!</p>';
      
$noform_var 1;
    }
    ELSE
    {
      
error_log(mysql_error());
      
$message '<p>Could not connect to the database.</p>';
    }


    
//Show the form in every case except successful submission
    
IF (!$noform_var)
    {
      
//$admin.php = $_SERVER['PHP_SELF'];
      
$message = <<< EOMSG
        <p><b>Welcome to the Athletic Webware Website Administration portal.</b></p>

          <FORM METHOD="post" ACTION="admin.php">
            <FIELDSET><LEGEND>Add Content</LEGEND>
              <div class="regrow">
                  <INPUT TYPE="hidden" NAME="date" VALUE="<?php print (date ("M d, Y")); ?>">
              <span class="label">Title:</span>
              <span class="field"><INPUT TYPE="text" NAME="title" maxlength="60" size="55">
              </div>
              <div class="regrow">
              <span class="label">Content:</span>
              <span class="field"><TEXTAREA NAME="content" rows="5" cols="41"></TEXTAREA>
              </div>
              <div class="regrow">
              <span class="label">Location:</span>
              <span class="field"><SELECT size="1" NAME="page">
                <option selected>&nbsp;</option
                <option>lcol_home</option>
                <option>lcol_products</option>
                <option>lcol_support</option>
                <option>lcol_donate</option>
                <option>lcol_login</option>
                <option>lcol_register</option>
                <option>main_home</option>
                <option>main_products</option>
                <option>main_support</option>
                <option>main_donate</option>
                <option>main_login</option>
                <option>main_register</option>
              </SELECT>
              </span>
              <div class="regrow">
              <center>
              <INPUT TYPE="SUBMIT" NAME="submit" Value="Submit">
          <INPUT TYPE="RESET" NAME="reset" VALUE="Reset Form">
          </center>
          </div>

          </FORM>
        EOMSG;
    }
}
?>



<html>

<head>
<title>AWW -  Your Home for Athletic Department Web Based Applications</title>

<!-- include styleone.css -->
    <LINK rel="stylesheet" href="inc/styleone.css" type="text/css">
<!-- end include -->

</head>

<body>

<table width="750" cellspacing="0" cellpadding="0">

<?php

#begin include topnav.php
 include('inc/topnav.php')
#end include

?>

</table>

<table width="750" cellspacing="0" cellpadding="0">

    <tr>
        <td class="lcol" width="273" height="400">&nbsp;</td>
        <td class="vlines">&nbsp;</td>
        <td class="main"><?php echo 
$message; ?></td>
    </tr>
</table>

<?php

#begin include footer.php
 include('inc/footer.php')
#end include

?>

</body>

</html>

Last edited by andersonoo7; 06-16-2005 at 12:33 AM..
andersonoo7 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-16-2005, 03:02 AM
Novice Talker

Posts: 7
Trades: 0
Hi,

a possible error is, that there are no spaces allowed before the Heredoc-Tags.

Greetings,
Thomas
Lutz-Development is offline
Reply With Quote
View Public Profile
 
Old 06-16-2005, 05:43 AM
stoot98's Avatar
Ultra Talker

Posts: 427
Name: Stuart
Location: Glasgow, Scotland
Trades: 0
you need a semi-colon after the include statement for footer.php.

PHP Code:
include('inc/footer.php'); 
stoot98 is offline
Reply With Quote
View Public Profile
 
Old 06-16-2005, 10:32 AM
Junior Talker

Posts: 3
Trades: 0
Quote:
Hi,

a possible error is, that there are no spaces allowed before the Heredoc-Tags.

Greetings,
Thomas
Can you please explain what these are?



Quote:
you need a semi-colon after the include statement for footer.php.
I don't believe this is the problem because they've worked without the semicolon on all other pages.



Any other tips greatly appreciated as are these two.
andersonoo7 is offline
Reply With Quote
View Public Profile
 
Old 06-16-2005, 10:38 AM
Anacrusis's Avatar
Defies a Status

Posts: 2,099
Name: Adam
Location: Colchester CT
Trades: 0
A heredoc tag is your <<< EOMSG .... EOMSG;

the last tag must be the first on the line with no leading spaces. Like this:
PHP Code:
$message = <<< EOMSG
     Here is some text
     The ending heredoc tag (EOMSG) MUST be the first thing on the line:
EOMSG; 
All php commands must end with a semicolon. Even if for some reason it worked on other pages, you should code this way.
Anacrusis is offline
Reply With Quote
View Public Profile
 
Old 06-17-2005, 02:25 AM
Junior Talker

Posts: 3
Trades: 0
Quote:
Originally Posted by Anacrusis
A heredoc tag is your <<< EOMSG .... EOMSG;

the last tag must be the first on the line with no leading spaces. Like this:
PHP Code:
$message = <<< EOMSG
     Here is some text
     The ending heredoc tag (EOMSG) MUST be the first thing on the line:
EOMSG; 
All php commands must end with a semicolon. Even if for some reason it worked on other pages, you should code this way.
OK got the page to parse correctly, but now the only thing that shows is the message 'The site has been updated!!' and there is a row (albeit, empty) added to the db, can't get the form to display. More help?
andersonoo7 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Parse error help...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23549 seconds with 12 queries