473,513 Members | 2,777 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_code"
size="3" title="International 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_code'
size='3' title="International 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 1763
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**********@hadenoughalready.comwrote in message
news:Yg*******************@newsfe1-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_code"
size="3" title="International 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_code'
size='3' title="International 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**********@hadenoughalready.comwrote in message
news:VA******************@newsfe4-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.comwrote in message
news:YAUSg.478$UJ2.294@fed1read07...
>
"Cerebral Believer" <no**********@hadenoughalready.comwrote in message
news:VA******************@newsfe4-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**********@hadenoughalready.comwrote in message
news:MM******************@newsfe3-gui.ntli.net...
>
"Johnny" <re*****************@hotmail.comwrote in message
news:YAUSg.478$UJ2.294@fed1read07...
>>
"Cerebral Believer" <no**********@hadenoughalready.comwrote in message
news:VA******************@newsfe4-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($field, 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
4907
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...
19
33066
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 --. ...
2
20481
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
1618
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...
28
13151
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 ...
35
5796
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
1777
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 ...
4
1471
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...
0
7254
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,...
0
7153
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...
0
7373
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,...
1
7094
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...
0
4743
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1585
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 ...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
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...

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.