NameSilo

Image

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

Archimed

Account Closed
Impact
1
hey guys sup?
I need help with inserting images into PHP :(

I have this
Code:
<?
nav(".: Home :.",$a,"home");
nav(".: News :.",$b,"news");
nav(".: Services :.",$c,"serv");
nav(".: Portfolio :.",$d,"port");
nav(".: About us :.",$e,"about");
nav(".: Contact us :.",$f,"contact");
?>
Now i want to .: Home :. to be image (i.e. but1_1.jpg)
and when mosue is over (i.e. but1_2.jpg) but mouseover is optional

i have tried this way

Code:
<?
$img1 = "<img src\"images/but1_1.jpg\" />"
?>
<?
nav("$img1",$a,"home");
nav(".: News :.",$b,"news");
nav(".: Services :.",$c,"serv");
nav(".: Portfolio :.",$d,"port");
nav(".: About us :.",$e,"about");
nav(".: Contact us :.",$f,"contact");
?>

This one doesnt work this one shows some www.ipgfx.net/test/index1.php look what it shows .... some uninsterted like not finsihed picture :'(
Please Someone Help!
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
This was your code:
Archimed said:
PHP:
<?
$img1 = "<img src\"images/but1_1.jpg\" />"
?>
<?
nav("$img1",$a,"home");
nav(".: News :.",$b,"news");
nav(".: Services :.",$c,"serv");
nav(".: Portfolio :.",$d,"port");
nav(".: About us :.",$e,"about");
nav(".: Contact us :.",$f,"contact");
?>
You should try this:
PHP:
<?
$img1 = "<img src\"images/but1_1.jpg\" />"
?>
<?
nav(" . $img1 . ",$a,"home");
nav(".: News :.",$b,"news");
nav(".: Services :.",$c,"serv");
nav(".: Portfolio :.",$d,"port");
nav(".: About us :.",$e,"about");
nav(".: Contact us :.",$f,"contact");
?>

-Steve
 
0
Close
You forget the = after src....

Try that :
$img1 = "<img src=\"images/but1_1.jpg\" />"
 
0
Close
Thanks!!

Thanks guys :hi: It really helped... may i ask one more quetsion.... How do i add like mouseover..

EDIT: When i do this i get an error of some unexpected Variable :'(
Code:
<? 
$img1 = "<img src=\"images/but1_1.jpg\" />"
$img2 = "<img src=\"images/but1_2.jpg\" />"
$img3 = "<img src=\"images/but1_3.jpg\" />"
$img4 = "<img src=\"images/but1_4.jpg\" />"
$img5 = "<img src=\"images/but1_5.jpg\" />"
$img6 = "<img src=\"images/but1_6.jpg\" />"
?> 
<? 
nav(" . $img1 . ",$a,"home"); 
nav(" . $img2 . ",$b,"news"); 
nav(" . $img3 . ",$c,"serv"); 
nav(" . $img4 . ",$d,"port"); 
nav(" . $img5 . ",$e,"about"); 
nav(" . $img6 . ",$f,"contact"); 
?>
 
Last edited:
0
Close
Try this:
PHP:
<? 
$img1 = "<img src='images/but1_1.jpg' />";
$img2 = "<img src='images/but1_2.jpg' />";
$img3 = "<img src='images/but1_3.jpg' />";
$img4 = "<img src='images/but1_4.jpg' />";
$img5 = "<img src='images/but1_5.jpg' />";
$img6 = "<img src='images/but1_6.jpg' />";

nav(" . $img1 . ",$a,"home"); 
nav(" . $img2 . ",$b,"news"); 
nav(" . $img3 . ",$c,"serv"); 
nav(" . $img4 . ",$d,"port"); 
nav(" . $img5 . ",$e,"about"); 
nav(" . $img6 . ",$f,"contact"); 
?>
That should work for you, you didn't close your variables that contained the links to the images.

Just a word of advice: When entering PHP code, use the
PHP:
 tags.

-Steve
 
0
Close
Thanks, Again... :hi:
Took your advice :)
And Btw how do i do the mouse over thing you know.. in php

tried this... doesnt work :(
PHP:
<? 
$img1 = "<img src='images/but1_1.jpg' name="Image1" width="127" height="27" border="0" id="Image1" onMouseOver="MM_swapImage('Image1','','images/but2_1.jpg',1)" onMouseOut="MM_swapImgRestore() />"; 
$img2 = "<img src='images/but1_2.jpg' />"; 
$img3 = "<img src='images/but1_3.jpg' />"; 
$img4 = "<img src='images/but1_4.jpg' />"; 
$img5 = "<img src='images/but1_5.jpg' />"; 
$img6 = "<img src='images/but1_6.jpg' />"; 

nav("$img1",$a,"home"); 
nav("$img2",$b,"news"); 
nav("$img3",$c,"serv"); 
nav("$img4",$d,"port"); 
nav("$img5",$e,"about"); 
nav("$img6",$f,"contact"); 
?>
 
0
Close
1
Close
Thanks, stscac You were really good help :)

I am sorry to ask again :red:

This is My Original HTML CODE, Now
HTML:
<tr> 
      <td width="127"><a href="#"><img src="images/but1_1.jpg" name="Image1" width="127" height="27" border="0" id="Image1" onMouseOver="MM_swapImage('Image1','','images/but2_1.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>
      <td width="126"><a href="#"><img src="images/but1_2.jpg" name="Image2" width="126" height="27" border="0" id="Image2" onMouseOver="MM_swapImage('Image2','','images/but2_2.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>
      <td width="128"><a href="#"><img src="images/but1_3.jpg" name="Image3" width="128" height="27" border="0" id="Image3" onMouseOver="MM_swapImage('Image3','','images/but2_3.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>
      <td width="126"><a href="#"><img src="images/but1_4.jpg" name="Image4" width="126" height="27" border="0" id="Image4" onMouseOver="MM_swapImage('Image4','','images/but2_4.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>
      <td width="117"><a href="#"><img src="images/but1_5.jpg" name="Image5" width="129" height="27" border="0" id="Image5" onMouseOver="MM_swapImage('Image5','','images/but2_5.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>
      <td width="136"><a href="#"><img src="images/but1_6.jpg" name="Image6" width="124" height="27" border="0" id="Image6" onMouseOver="MM_swapImage('Image6','','images/but2_6.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></td>
    </tr>

As STSCAC said how to do this i did it...

PHP:
<?
$imH = 27;
$imW = 127;
$img1 = "<img src='images/but1_1.jpg' />"; 
$img2 = "<img src='images/but1_2.jpg' />"; 
$img3 = "<img src='images/but1_3.jpg' />"; 
$img4 = "<img src='images/but1_4.jpg' />"; 
$img5 = "<img src='images/but1_5.jpg' />"; 
$img6 = "<img src='images/but1_6.jpg' />"; 

nav("$img1",$a,"home"); 
nav("$img2",$b,"news"); 
nav("$img3",$c,"serv"); 
nav("$img4",$d,"port"); 
nav("$img5",$e,"about"); 
nav("$img6",$f,"contact"); 
?>
But Now the problem is that i cannnot make them to be in like zise width and height i want.... I try it just displays the numbers i dont know how to connect them intothe varibale.. i know how to do in turing :'(
 
0
Close
PHP:
<? 
$imH = 27; 
$imW = 127; 
$img1 = "<img src='images/but1_1.jpg' width='$imW' height='$imH />"; 
$img2 = "<img src='images/but1_2.jpg' width='$imW' height='$imH />"; 
$img3 = "<img src='images/but1_3.jpg' width='$imW' height='$imH  />"; 
$img4 = "<img src='images/but1_4.jpg' width='$imW' height='$imH />"; 
$img5 = "<img src='images/but1_5.jpg' width='$imW' height='$imH />"; 
$img6 = "<img src='images/but1_6.jpg' width='$imW' height='$imH />"; 

nav($img1,$a,"home"); 
nav($img2,$b,"news"); 
nav($img3,$c,"serv"); 
nav($img4,$d,"port"); 
nav($img5,$e,"about"); 
nav($img6,$f,"contact"); 
?>
 
1
Close
SecondVersion said:
PHP:
<? 
$imH = 27; 
$imW = 127; 
$img1 = "<img src='images/but1_1.jpg' width='$imW' height='$imH />"; 
$img2 = "<img src='images/but1_2.jpg' width='$imW' height='$imH />"; 
$img3 = "<img src='images/but1_3.jpg' width='$imW' height='$imH  />"; 
$img4 = "<img src='images/but1_4.jpg' width='$imW' height='$imH />"; 
$img5 = "<img src='images/but1_5.jpg' width='$imW' height='$imH />"; 
$img6 = "<img src='images/but1_6.jpg' width='$imW' height='$imH />"; 

nav($img1,$a,"home"); 
nav($img2,$b,"news"); 
nav($img3,$c,"serv"); 
nav($img4,$d,"port"); 
nav($img5,$e,"about"); 
nav($img6,$f,"contact"); 
?>
Yep, this'll work. Optionally, you can make all this central for your pages if you want to use this as your header for many pages. All you have to do is save the header contents and then use php include() in all the content pages you want it to appear in.

:)

Let me know (along with the rest of us) if you have anything else you need help with.

-Steve
 
0
Close
so like i make a lets say buttons.php and put the code there. and then i just
write
PHP:
include "buttons.php";
and this will import it?
 
0
Close
Archimed said:
so like i make a lets say buttons.php and put the code there. and then i just
write
PHP:
include "buttons.php";
and this will import it?
Correct!

-Steve
 
0
Close
Got it :D

Using Include.....Works Perfect Thanks guys!! :hi:
 
0
Close
CatchedCatched

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back