Solved

php IF statement

Posted on 2015-02-22
5
47 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
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

733 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