Hi,
I created an HTML page with the following code:
<html>
<body>
<form action="everif.php" method="post">
Name: <input type="text" name="name" size="12"><br>
First name: <input type="text" name="fname" size="12">
<input type="submit" value="OK">
</form>
</body>
</html>
and everif.php contains:
<?php
$fname= $_POST['fname'];
$name= $_POST['name'];
echo("<center>Hi $fname $name</center>");
?>
When I press OK from the HTML page 1 get:
Parse error: parse error, unexpected T_VARIABLE in
/var/www/free.fr/d/c/parispain/everif.php on line 2
where line 2 is:
$fname= $_POST['fname'];
Why?
Thank you. 12 1446
> <?php $fname= $_POST['fname']; $name= $_POST['name']; echo("<center>Hi $fname $name</center>"); ?>
When I press OK from the HTML page 1 get: Parse error: parse error, unexpected T_VARIABLE in /var/www/free.fr/d/c/parispain/everif.php on line 2
where line 2 is: $fname= $_POST['fname'];
I am not sure but first of all you should check if $_POST['fname']; is set .
so it should be somthing like :
if (isset($_POST['fname'])) $fname = $_POST['fname'];
else $fname = "";
the same for the $_POST['name']
Try that ... but then again I am not sure if it solves your problem!!!
> echo("<center>Hi $fname $name</center>");
And This is not going to echo your $fname and $name ...
Do that:
echo ("Hello".$fname." ".$name); lo*************@yahoo.fr wrote: (snip) everif.php contains: <?php $fname= $_POST['fname']; $name= $_POST['name']; echo("<center>Hi $fname $name</center>"); ?>
When I press OK from the HTML page 1 get: Parse error: parse error, unexpected T_VARIABLE in /var/www/free.fr/d/c/parispain/everif.php on line 2
Your code looks Ok to me. You don't need any brackets in the echo statement,
but it doesn't really matter.
Perhaps there's a problem with the line breaks in your PHP source. I think
PHP likes to see a carriage return and linefeed at the end of every line.
Some editors (especially on Mac systems) use carriage returns but no
linefeeds.
--
phil [dot] ronan @ virgin [dot] net http://vzone.virgin.net/phil.ronan/
Angelos wrote: echo("<center>Hi $fname $name</center>");
And This is not going to echo your $fname and $name ...
Yes it is!
--
Oli
Philip Ronan wrote: Perhaps there's a problem with the line breaks in your PHP source. I
think PHP likes to see a carriage return and linefeed at the end of every
line. Some editors (especially on Mac systems) use carriage returns but no linefeeds.
Who told you that? You can write a whole PHP script all on line without
any newlines or carriage returns if you want.
--
Oli
On Tue, 17 May 2005 09:56:07 +0000 (UTC), Angelos wrote: echo("<center>Hi $fname $name</center>"); And This is not going to echo your $fname and $name ...
Yes it is.
Do that: echo ("Hello".$fname." ".$name);
No, no need for that when using double quotes.
--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
On Tue, 17 May 2005 11:12:10 +0100, Philip Ronan wrote: <?php $fname= $_POST['fname']; $name= $_POST['name']; echo("<center>Hi $fname $name</center>"); ?>
When I press OK from the HTML page 1 get: Parse error: parse error, unexpected T_VARIABLE in /var/www/free.fr/d/c/parispain/everif.php on line 2
Your code looks Ok to me.
Me too. Did you copy and paste the code in your news post, or type it?
Your error could be from one space too many, for example after <? or $.
--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Oli Filth wrote: Philip Ronan wrote: Perhaps there's a problem with the line breaks in your PHP source. I think PHP likes to see a carriage return and linefeed at the end of every line. Some editors (especially on Mac systems) use carriage returns but no linefeeds.
Who told you that? You can write a whole PHP script all on line without any newlines or carriage returns if you want.
I just seem to recall having a few parse errors of my own before I set my
text editor up to use DOS line breaks.
I can't see what else could be wrong with the OP's script.
Can you?
--
phil [dot] ronan @ virgin [dot] net http://vzone.virgin.net/phil.ronan/
I cut and paste the script so I do not think additional spaces could be
the origin of the problem.
However, I *AM* using a Mac and it could be a carriage return issue... lo*************@yahoo.fr wrote: I cut and paste the script so I do not think additional spaces could be the origin of the problem. However, I *AM* using a Mac and it could be a carriage return issue...
There are lots of decent free/shareware editors that might help. Try BBEdit
and JEdit, for example.
--
phil [dot] ronan @ virgin [dot] net http://vzone.virgin.net/phil.ronan/
OK,
The issue was just an uncorrect unicode space character replacing a
normal space, around an '=' sign.
Thank you very much,
Loïc This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Brian Madden |
last post by:
Hello Everyone,
This is sort of a followup to the protecting files question I asked earlier
today.
I would like to protect a file so that only certain users could download it
from my website....
|
by: Ian Giblin |
last post by:
I am an experienced C programmer, learning C++ by writinging a
mathematical toolkit in the framework of a script interpreter. I am
posting here to ask for advice (or references) on the object...
|
by: fernandez.dan |
last post by:
Hey I'm sorry if this is not the appropriate news group for this
question. I was wondering if anyone has any recommendation for
embbedding a script engine in a c++ application. I want to feed my...
|
by: Sinity |
last post by:
Anyone knows the method/codes to disable the clicked button after first
click by using .aspx-- to prevent people to click many time when waiting for
the server response.
I tried to do this by...
|
by: Fabrizio Cyber |
last post by:
Hi all,
I want to use a .js into a visual basic project. How can I do it ? I've
tried to open the script code into my project....and then ??? I see the code
but I don't jnow how to make it...
|
by: Ankur |
last post by:
Hi Folks,
I am new for this group. I want to clarify one thing what's a basic
difference between Client Side Java Script and Server Side Java
Script. how we can differentiate it. Why we called...
|
by: =?Utf-8?B?RGF2aWQ=?= |
last post by:
Hello
I'm trying to develop a Windows service, in visual studio 2005, which
executes a visual basic script. However, if the script interacts with the
file system (as it has to), the script...
|
by: Marc |
last post by:
Comming from JSP-HTML when I hear 'script' I think of JavaScript or perhaps
VBScript. But I think in ASP.NET they mean something else? I am bit confused
now.
Reading a book I see the following:...
|
by: manu |
last post by:
Hi,
I need to parse xml files for the Blender Game Engine. ATM I am trying
to get this script running in the BGE. This is my first script and I
dont have much experience programming...
import...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |