hyperlink to php file

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
CarlosB
Forum Newbie
Posts: 10
Joined: Tue Mar 27, 2007 5:16 am

hyperlink to php file

Post by CarlosB »

I know this is basic, but i have no idea on how to fix this! I have an image in a html page, and i wanto to make a link to a php page when you click on it. I have done it thousands of times, but now it just won't work =S when i click on the image it appear a window asking me if i wan't to download the php file! This is the code i'm using:

<img src="img/enviar.jpg" border="0" onClick="document.enviar.submit();">

Can anybody help me? Thanks!
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

If you're being asked to download the PHP file then it will be linking to it, but the server is doing something wrong. Have you tried going directly to the PHP file in your browser?

By the way, you can have <input type="image" src="... " />
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

If that image isn't being used to submit a form, you should wrap the image in an anchor tag, sans the javascript:

Code: Select all

<a href="something.php"><img src="asdf.jpg" border="0" /></a>
Post Reply