Solved

php IF statement

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

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

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…
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.
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 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 …

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

17 Experts available now in Live!

Get 1:1 Help Now