Solved

error on a specific line ...

Posted on 2012-04-13
6
196 Views
Last Modified: 2012-04-13
When I run this code I keep getting a syntax error, can someone let me know what the issue could be?

echo       '<input type="radio" name="status" value="1" id="status_1"'.if($row['visit_status'] == '1'){echo 'checked';}.'/>Complete</label>';

The error message I get is:

Parse error: syntax error, unexpected T_IF in C:\xampp\htdocs\module_p\editSchedule.php on line 78

Thanks for the help.

A
0
Comment
Question by:aej1973
  • 3
  • 2
6 Comments
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 37843935
Unexpected in a PHP parse error means that something is wrong up the script above the line number location of the of the parse error.  Maybe the error is in the same line or a line above it.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 37843939
Maybe try changing the dot to a semi-colon.
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 37843954
I would probably code it this way.
<?php // RAY_temp_aej1973.php

$x = '<input type="radio" name="status" value="1" id="status_1"';
if($row['visit_status'] == '1')
{
    $x .= ' checked';
}
$x .= '/>Complete</label>';
echo $x;

Open in new window

http://www.laprbass.com/RAY_temp_aej1973.php
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 7

Accepted Solution

by:
karunamoorthy earned 150 total points
ID: 37843986
This is what you want;

echo       '<input type="radio" name="status" value="1" id="status_1"'; if($row['visit_status'] == '1'){echo 'checked';}; echo '/>Complete</label>';
0
 

Author Comment

by:aej1973
ID: 37844100
karunamoorthy, perfect! This is what I was looking for.

A
0
 

Author Closing Comment

by:aej1973
ID: 37844107
Thanks.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now