Solved

php IF statement

Posted on 2015-02-22
5
50 Views
Last Modified: 2015-02-27
I have the following code in a working PHP page but this stops it loading:
----------------------
$im_art = $_GET['artist'];

<?php if ($im_art = "El Glinoer") {
<div class="body_text_large_artists" align="left"><?php echo $row_artInfo[artinf_Name]; ?></div><div class="body_text_large_cv"><a href="artistInfoCV.php?artist=<?php echo urlencode($im_art); ?>" target="_parent">Artist's CV</a><div class="div_archives_link"><a href="artistInfoArchives.php?artist=<?php echo urlencode($im_art); ?>" target="_parent">Archived&nbsp;Images</a> }
----------------------

Any ideas anyone ?
0
Comment
Question by:doctorbill
[X]
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
  • 3
  • 2
5 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40624602
$im_art = "El Glinoer" with a single '=' is an assignment.  $im_art == "El Glinoer" with two '==' is a comparison which is what you usually want.  Other problems too.  This may work better.
<?php if ($im_art == "El Glinoer") { ?>
<div class="body_text_large_artists" align="left"><?php echo $row_artInfo[artinf_Name]; ?></div>
<div class="body_text_large_cv"><a href="artistInfoCV.php?artist=<?php echo urlencode($im_art); ?>" target="_parent">Artist's CV</a>
<div class="div_archives_link"><a href="artistInfoArchives.php?artist=<?php echo urlencode($im_art); ?>" target="_parent">Archived&nbsp;Images</a> 
<?php } ?>

Open in new window

0
 

Author Comment

by:doctorbill
ID: 40624610
Thanks Dave - perfect
0
 

Author Comment

by:doctorbill
ID: 40635843
I've requested that this question be closed as follows:

Accepted answer: 500 points for Dave Baldwin's comment #a40624602
Assisted answer: 0 points for doctorbill's comment #a40624610

for the following reason:

solved within 5 minutes
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40624683
You're welcome.!
0
 

Author Closing Comment

by:doctorbill
ID: 40635844
complete
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

717 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