954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

position the image on right side of the page.

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>
sujan.dasmahapa
Light Poster
32 posts since Apr 2009
Reputation Points: 10
Solved Threads: 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 :)

cereal
Master Poster
709 posts since Aug 2007
Reputation Points: 214
Solved Threads: 120
 

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>
sujan.dasmahapa
Light Poster
32 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

use or to position your image...

Karthik_pranas
Posting Pro
564 posts since Feb 2011
Reputation Points: 96
Solved Threads: 97
 

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

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 

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

cereal
Master Poster
709 posts since Aug 2007
Reputation Points: 214
Solved Threads: 120
 

yes

sujan.dasmahapa
Light Poster
32 posts since Apr 2009
Reputation Points: 10
Solved Threads: 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.

sujan.dasmahapa
Light Poster
32 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

Fine, mark the thread as solved, bye :)

cereal
Master Poster
709 posts since Aug 2007
Reputation Points: 214
Solved Threads: 120
 

Thanks a lot friend

sujan.dasmahapa
Light Poster
32 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You