PHP Link Bug

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
php-forum Fan User
php-forum Fan User
Posts: 974
Joined: Mon Oct 01, 2012 12:32 pm

Thu Mar 28, 2013 10:30 pm

if you were manually writing your markup instead of echoing it out; wouldn't you close your image tags with greater than signs?

Code: Select all

          echo('<img src="/images/its_a_boy.jpg"');//see what i mean?

New php-forum User
New php-forum User
Posts: 20
Joined: Tue Mar 06, 2012 11:05 pm

Mon Apr 15, 2013 1:30 am

Hi dylanm312,

Here your image tag is not closed. So the link comes as a text. Please see the code below: :)

Code: Select all

$gender = $_POST['gender'];

if($gender == 'Male'){
      echo('<img src="/images/its_a_boy.jpg"/>');
   }else {
      echo('<img src="/images/its_a_girl.jpg" />');
   echo('<a href="/index.html">Return</a>');

Post Reply