i am creating a button on the page and pressing button loads an image. when the image loaded button is moving down and the image occupies the top-left portion. How can i position the image on the right hand side, so that my buttons dont move and the images comes on the right side at some specified loacation and size. Please help me resolving this. check the code snippet below.

<?php
if(isset($_POST['submit']))
{ 
$imagepath = "shirt7.jpg";
echo "<img src='$imagepath' />";
}
?>

<form method="post" action="">
<input type="submit" name="submit" value="Submit Form">
/form>

Basically you can add style="float:right;" to img tag. This thread is related more to CSS forum than PHP, I suggest you to move it, bye :)

is this correct. My image is not loading on right. A red cross(X) sign is coming.

<?php
if(isset($_POST['submit']))
{ 
$imagepath = "shirt7.jpg";
echo '<img src="$imagepath" style="float:right;"  />';
}
?>

<form method="post" action="">
<input type="submit" name="submit" value="Submit Form">
</form>

use <table> or <div> to position your image...

Member Avatar

diafol

If a little red cross shows up it means the source (src) is wrong. Check the path and filename in the browser's 'view source'.

is this correct. My image is not loading on right. A red cross(X) sign is coming.

$imagepath = "shirt7.jpg"; # check this!

Then check the path. Is your image in the same directory of your script file?


oops! Hi Ardav ;D

its working now friend. i just had to put like this

<?php
if(isset($_POST['submit']))
{ 
$imagepath = "shirt7.jpg";
echo "<img style='float:right;' src='$imagepath' />";
}
?>

<form method="post" action="">
<input type="submit" name="submit" value="Submit Form">
</form>

Thanks a lot friend.

Fine, mark the thread as solved, bye :)