0

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>
4
Contributors
9
Replies
10
Views
5 Years
Discussion Span
Last Post by sujan.dasmahapa
0

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 :)

0

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>
0

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

Edited by diafol: n/a

0

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

Edited by cereal: n/a

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.