By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,348 Members | 1,397 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,348 IT Pros & Developers. It's quick & easy.

Include file error (novice).

P: n/a
Mo
I have a form which I use to get a date range for reports. I am
beginning to build many more reports than initially thought, and I use
this form in each one. I expect to manage/improve the form, so I want
to just include it from it's own file.
I want to break out of PHP for my form area (instead of having to deal
with a whole bunch of print/echo statements and the added debugging
layer), but am getting an error.

ERROR:
Parse error: syntax error, unexpected $end in /home/voyager1/
public_html/turbine/dateRange_form.inc on line 17

How do I remedy the error?

Here are the ENTIRE contents of dateRange_form.inc:
?>
<form name="dateRange" method="GET" >
<table>
<tr>
<td align="center" class="">From date:
<input name='fromDate' value='<?=date("Y-m-
d",mktime(0,0,0,date("m")-1,1,date("Y")));?>' size=15>
</td>
<td align="center" class="">To date:
<input name='toDate' value='<?=date("Y-m-
t",mktime(0,0,0,date("m")-1,1,date("Y")));?>' size=15>
</td>
<td align="center">
<input type='submit' value='Search'>
</td>
</tr>
</table>
</form>
<?PHP
Oct 9 '08 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Message-ID:
<74**********************************@p10g2000prf. googlegroups.comfrom
Mo contained the following:
>ERROR:
Parse error: syntax error, unexpected $end in /home/voyager1/
public_html/turbine/dateRange_form.inc on line 17

How do I remedy the error?
Works fine for me. You probably don't have short tags enabled (short
tags are not generally regarded as a good idea anyway)

Try replacing '<?= ' with '<?php echo '
--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011
http://slipperyhill.co.uk - http://4theweb.co.uk
Oct 9 '08 #2

P: n/a
Mo
On Oct 9, 3:11*pm, Geoff Berrow <blthe...@ckdog.co.ukwrote:
Message-ID:
<74d6d4a2-caa1-4d25-9e20-c5b7ad76a...@p10g2000prf.googlegroups.comfrom
Mo contained the following:
ERROR:
Parse error: syntax error, unexpected $end in /home/voyager1/
public_html/turbine/dateRange_form.inc on line 17
How do I remedy the error?

Works fine for me. You probably don't have short tags enabled (short
tags are not generally regarded as a good idea anyway)

Try replacing '<?= ' with '<?php echo '

--
Geoff Berrow *0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011http://slipperyhill.co.uk-http://4theweb.co.uk
Hmm.
I'm glad it works (for you at least), but am still stymied.

Short tags are enabled, and the code works as-is when inline, but get
the error when used via include.
The error references line 17. That it the last line. The one which re-
opens PHP.

Any further ideas?

~ Mo
Oct 9 '08 #3

P: n/a
Mo wrote:
On Oct 9, 3:11 pm, Geoff Berrow <blthe...@ckdog.co.ukwrote:
>Message-ID:
<74d6d4a2-caa1-4d25-9e20-c5b7ad76a...@p10g2000prf.googlegroups.comfrom
Mo contained the following:
>>ERROR:
Parse error: syntax error, unexpected $end in /home/voyager1/
public_html/turbine/dateRange_form.inc on line 17
How do I remedy the error?
Works fine for me. You probably don't have short tags enabled (short
tags are not generally regarded as a good idea anyway)

Try replacing '<?= ' with '<?php echo '

--
Geoff Berrow 0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011http://slipperyhill.co.uk-http://4theweb.co.uk

Hmm.
I'm glad it works (for you at least), but am still stymied.

Short tags are enabled, and the code works as-is when inline, but get
the error when used via include.
The error references line 17. That it the last line. The one which re-
opens PHP.

Any further ideas?

~ Mo
Yeah leave out the ?in the beginning and <?php at the end

Scotty
Oct 9 '08 #4

P: n/a
Mo
On Oct 9, 3:49*pm, FutureShock <futuresho...@att.netwrote:
Mo wrote:
On Oct 9, 3:11 pm, Geoff Berrow <blthe...@ckdog.co.ukwrote:
Message-ID:
<74d6d4a2-caa1-4d25-9e20-c5b7ad76a...@p10g2000prf.googlegroups.comfrom
Mo contained the following:
>ERROR:
Parse error: syntax error, unexpected $end in /home/voyager1/
public_html/turbine/dateRange_form.inc on line 17
How do I remedy the error?
Works fine for me. You probably don't have short tags enabled (short
tags are not generally regarded as a good idea anyway)
Try replacing '<?= ' with '<?php echo '
--
Geoff Berrow *0110001001101100010000000110
001101101011011001000110111101100111001011
100110001101101111001011100111010101101011http://slipperyhill.co.uk-http://4theweb.co.uk
Hmm.
I'm glad it works (for you at least), but am still stymied.
Short tags are enabled, and the code works as-is when inline, but get
the error when used via include.
The error references line 17. That it the last line. The one which re-
opens PHP.
Any further ideas?
~ Mo

Yeah leave out the ?in the beginning and <?php at the end

Scotty
Since my include is, naturally, withhin a PHP block, I presumed that
it would expect PHP, and that close and open tags would be required if
I was including HTML.

Thanks-a-bunch.
Your solution SIMPLY WORKS ... but why?
Why aren't echo/print statements needed?

~ Mo
Oct 9 '08 #5

P: n/a
..oO(Mo)
>Since my include is, naturally, withhin a PHP block, I presumed that
it would expect PHP, and that close and open tags would be required if
I was including HTML.
When including a file, PHP jumps back into HTML mode. You always have to
use <?php ... ?tags in an include file around your PHP code. This is
described in the manual.

Micha
Oct 9 '08 #6

P: n/a
Mo
On Oct 9, 4:19*pm, Michael Fesser <neti...@gmx.dewrote:
.oO(Mo)
Since my include is, naturally, withhin a PHP block, I presumed that
it would expect PHP, and that close and open tags would be required if
I was including HTML.

When including a file, PHP jumps back into HTML mode. You always have to
use <?php ... ?tags in an include file around your PHP code. This is
described in the manual.

Micha
Ah, there it is.
I've found it now where it specifies that in the manual.

Thanks to all.

~ Mo
Oct 9 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.