473,671 Members | 2,580 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 1772
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
4915
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
33090
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
20510
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
1635
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
13186
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
5826
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
1784
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
1476
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
8930
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8828
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...
1
8605
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8677
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5704
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
4417
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2819
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
2062
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1816
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.