473,785 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Parse Errors & Quote Marks

Hi folks,

I am having trouble identifying the error here can anyone help?

Parse error: syntax error on line 318

$e-mail_1 = $_POST['e-mail_1'];

Also will my use of " " (double quotes) instead of ' ' (single quotes) make
much difference to the way this code works? It is from a section of code
that is returning values to a form after it has been validated.

<tr>
<td>
{$label_array['int_code']}
</td>
<td>
<input type="text" class="f_form" name="int_code" value="$int_cod e"
size="3" title="Internat ional Code: valid characters 0-9, (3 digits)"/>
</td>
</tr>

I am transfering an HTML form in XHTML 1.0 Transitional to php. The book I
am reading has the code listed like this:

<tr>
<td>
{$label_array['int_code']}
</td>
<td>
<input type='text' class="f_form" name='int_code' value='$int_cod e'
size='3' title="Internat ional Code: valid characters 0-9, (3 digits)"/>
</td>
</tr>

So the code in the book is presented in single quotes instead of double
quotes, but the extra code I have inserted is still in single quotes. I
know I need to specify maxlength values too. Will the difference in use of
quotes make much differnce?

Regards,
C.B.
Sep 28 '06 #1
6 1778
Cerebral Believer wrote:
I am having trouble identifying the error here can anyone help?
Parse error: syntax error on line 318
$e-mail_1 = $_POST['e-mail_1'];
"-" isn't allowed in variables, because it's an operator:
http://www.webcheatsheet.com/php/variables.php

Regards,
Oliver
Sep 28 '06 #2
I should have pointed out that line 318 is the line displayed, and the error
is a syntax error, unexpected '='...

"Cerebral Believer" <no**********@h adenoughalready .comwrote in message
news:Yg******** ***********@new sfe1-win.ntli.net...
Hi folks,

I am having trouble identifying the error here can anyone help?

Parse error: syntax error on line 318

$e-mail_1 = $_POST['e-mail_1'];

Also will my use of " " (double quotes) instead of ' ' (single quotes)
make much difference to the way this code works? It is from a section of
code that is returning values to a form after it has been validated.

<tr>
<td>
{$label_array['int_code']}
</td>
<td>
<input type="text" class="f_form" name="int_code" value="$int_cod e"
size="3" title="Internat ional Code: valid characters 0-9, (3 digits)"/>
</td>
</tr>

I am transfering an HTML form in XHTML 1.0 Transitional to php. The book
I am reading has the code listed like this:

<tr>
<td>
{$label_array['int_code']}
</td>
<td>
<input type='text' class="f_form" name='int_code' value='$int_cod e'
size='3' title="Internat ional Code: valid characters 0-9, (3 digits)"/>
</td>
</tr>

So the code in the book is presented in single quotes instead of double
quotes, but the extra code I have inserted is still in single quotes. I
know I need to specify maxlength values too. Will the difference in use
of quotes make much differnce?

Regards,
C.B.

Sep 28 '06 #3

"Cerebral Believer" <no**********@h adenoughalready .comwrote in message
news:VA******** **********@news fe4-gui.ntli.net...
I should have pointed out that line 318 is the line displayed, and the
error
is a syntax error, unexpected '='...
which is consistent with Oliver's post pointing out that - is not allowed in
a var name,
it's interpretting that you said

$e - mail_1 = $_POST['e-mail_1'];
php expects operators to be on the right hand side of the =


Sep 28 '06 #4

"Johnny" <re************ *****@hotmail.c omwrote in message
news:YAUSg.478$ UJ2.294@fed1rea d07...
>
"Cerebral Believer" <no**********@h adenoughalready .comwrote in message
news:VA******** **********@news fe4-gui.ntli.net...
>I should have pointed out that line 318 is the line displayed, and the
error
>is a syntax error, unexpected '='...

which is consistent with Oliver's post pointing out that - is not allowed
in
a var name,
it's interpretting that you said

$e - mail_1 = $_POST['e-mail_1'];
php expects operators to be on the right hand side of the =
Yes, thanks I just changed this, and have started to debug - this is my
first PHP script so I am just getting used to what is allowable in PHP. I
hadn't seen Johnny's post at the time I posted due to a mess up with my
newsreader.

Do you know if:

if ( $value == "" )
{
if ($field != "address_2" or "address_3" or "int_code" or
"extension" )
{
$blank_array[$field] = "blank";
}
}

Is the right way to express that only these fields are allowed to be blank?

Regards,
C.B.
Sep 28 '06 #5
Sorry, I meant I hadn't seen Olivers post. Thanks Oliver!

"Cerebral Believer" <no**********@h adenoughalready .comwrote in message
news:MM******** **********@news fe3-gui.ntli.net...
>
"Johnny" <re************ *****@hotmail.c omwrote in message
news:YAUSg.478$ UJ2.294@fed1rea d07...
>>
"Cerebral Believer" <no**********@h adenoughalready .comwrote in message
news:VA******* ***********@new sfe4-gui.ntli.net...
>>I should have pointed out that line 318 is the line displayed, and the
error
>>is a syntax error, unexpected '='...

which is consistent with Oliver's post pointing out that - is not allowed
in
a var name,
it's interpretting that you said

$e - mail_1 = $_POST['e-mail_1'];
php expects operators to be on the right hand side of the =

Yes, thanks I just changed this, and have started to debug - this is my
first PHP script so I am just getting used to what is allowable in PHP. I
hadn't seen Johnny's post at the time I posted due to a mess up with my
newsreader.

Do you know if:

if ( $value == "" )
{
if ($field != "address_2" or "address_3" or "int_code" or
"extension" )
{
$blank_array[$field] = "blank";
}
}

Is the right way to express that only these fields are allowed to be
blank?

Regards,
C.B.

Sep 28 '06 #6
Cerebral Believer wrote:
Sorry, I meant I hadn't seen Olivers post. Thanks Oliver!
You're welcome. alt.php isn't available at my provider (yet), maybe that's
why you didn't get my post.

if ($field != "address_2" or "address_3" or "int_code" or "extension" )
I guess you mean

if (($field != 'address_2') && ($field != 'address_3') ...)

or better

if (!in_array($fie ld, array('address_ 2', 'address_3', ...))
$blank_array[$field] = "blank";
Is the right way to express that only these fields are allowed to be
blank?
Depends on what you do with $blank_array?

Regards,
Oliver

Sep 28 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4922
by: Dennis M. Marks | last post by:
I am looking for a javascript function that will parse a query string. Parameters are passed in the url: url?a=3&c=5&etc An array is returned that uses the variable name as the index. array=3 array=5 etc. -- Dennis M. Marks http://www.dcs-chico.com/~denmarks/
19
33099
by: Philipp Lenssen | last post by:
I don't know the English word, but I'm referring to the double-dash which is used to separate parts of a sentence. I'm using — so far. Now I saw – which is slightly shorter. Some sites use --. Is there anything I should know to make a good decision on which to use, other than what looks best? I think the W3C validator is always handing out errors, even when I go through the different charsets. I remember a time when the W3C validator...
2
20534
by: Eric Osman | last post by:
Hi, I'm looking for a javascript function that will convert input such as this: <CLUB Code=" into this: &lt;CLUB Code=&quot;
10
1642
by: yawnmoth | last post by:
I have two servers that have had PHP installed on them and... <?php echo 'hello, world! ?> ....displays a parse error on server A and doesn't display anything on server B. Any ideas as to what the problem is?
28
13207
by: entfred | last post by:
I have the following line of html: &nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nbsp;&nbsp;&nbspyow In Internet Explorer 6.0, the columns look ok using the above html: 1234 abcd yow But, in firefox, for same html, getting this:
35
5851
by: pandit | last post by:
is this book good for learning C ? i am a beginning programmer, Kernighan and Ritchie 2e is quite hard on me.
6
1788
by: Neelesh2007 | last post by:
Hi all. In my project I am using VB6.0 & Access 2003. I want to create Slab wise & Pagewise Datareport as shown below. Marks <30 ID Subject Marks 11 Maths 25 75 Science 18 <page Break>
4
1484
by: Damodhar | last post by:
Any one help me to parse the bellow xml feed please .. =========================================================== <item> <title>Green earthquake alert Japan(M=6.8) potentially affecting 4.6 million people.</title> <pubDate>Fri, 13 Jun 2008 23:43 UTC</pubDate> <gdas:eventType>EQ</gdas:eventType> <gdas:alertLevel>Green</gdas:alertLevel>
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8978
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7502
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.