NameSilo

Image

Spaceship Spaceship
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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
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
•••
You forget the = after src....

Try that :
$img1 = "<img src=\"images/but1_1.jpg\" />"
 
0
•••
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
•••
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
•••
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
•••
1
•••
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
•••
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
•••
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
•••
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
•••
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
•••
Got it :D

Using Include.....Works Perfect Thanks guys!! :hi:
 
0
•••
Dynadot โ€” .com Registration $8.99Dynadot โ€” .com Registration $8.99
Appraise.net
Unstoppable Domains
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back