Jump to content

Preview image from Dropdown...


spikypunker

Recommended Posts

Hey guys :)

 

Am trying to develop a page where a user has a dropdown box and chooses an image. I found a simple script that achieves this usign javascript here:

 

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Brand IT - Home page</title>
<link rel=stylesheet href="brandit.css" type=text/css></link>

<script language="javascript">

function showimage()
{
if (!document.images)
return
document.images.pictures.src=
document.mygallery.picture.options[document.mygallery.picture.selectedIndex].value
}

</script>

</head>

 

 

<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><form name="mygallery" action="mail.php" method="post"><p>
<select name="picture" size="1" onChange="showimage()">
<option selected value="http://www.#.co.uk/emails/gocruise/images/header1.jpg">Picture of me</option>
<option value="http://www.#.co.uk/emails/gocruise/images/header3.jpg">Picture of my aunt</option>
<option value="http://www.#.co.uk/emails/gocruise/images/header2.jpg">Picture of my brother</option>
</select>
<input name="" type="submit" />
</p>
</form>
</td>
</tr>
<tr>
<td width="100%"><p align="center"><img src="http://www.#.co.uk/emails/gocruise/images/header1.jpg" name="pictures" width="99" height="100"></td>
</tr>
</table>

 

 

This works really well, but as soon as i add a SUBMIT button with an action and method, it stops working....

 

I guess i can understand why it does this but i cant think of a way to make it work. The idea is the user chooses the image and then a couple of other fields and then a mailer.php page sends an email with the choices they made.

 

 

Does anyone know how this is possible?

 

 

Kind Regards, Chris H

 

Link to comment
https://forums.phpfreaks.com/topic/190927-preview-image-from-dropdown/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.