Solved

error on a specific line ...

Posted on 2012-04-13
6
195 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
Comment Utility
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
Comment Utility
Maybe try changing the dot to a semi-colon.
0
 
LVL 108

Expert Comment

by:Ray Paseur
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 7

Accepted Solution

by:
karunamoorthy earned 150 total points
Comment Utility
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
Comment Utility
karunamoorthy, perfect! This is what I was looking for.

A
0
 

Author Closing Comment

by:aej1973
Comment Utility
Thanks.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
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…
The viewer will learn how to dynamically set the form action using jQuery.

763 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

5 Experts available now in Live!

Get 1:1 Help Now