Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

error on a specific line ...

Posted on 2012-04-13
6
198 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 109

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 109

Expert Comment

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

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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 …
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

860 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