Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > PHP / mySQL

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 08-23-2016, 08:28 PM   #1
alexwaston
Registered User
 
Join Date: Aug 2016
Posts: 4
Transfer value from form using form.submit?

Hi. I am new to creating websites, so please excuse my ignorance.

I have a form containing two thumbnails. I have used the Onclick(pict) to call a function which should send the value pict to a new page but it doesn't work.

The idea is that the second page will look up the image details in a csv file and display the full size picture in the new form. This means that I don't have to have a different html page for each image.

This is my first form:

<html>
<head>
<title>OnClick</title>
</head>
<body>
<form name = "Form1"
action = "ShowImage.php"
method = "post">
</form>

<script type = "text/javascript">
//<![CDATA[
var pict = 0;

function func1(pict)
{
alert("picture " + pict);
document.Form1.submit();
}
//]]>
</script>

<p><img src="DSCF1668.jpg" onclick="func1(0);" style="width: 150px; height: 150px">
<img src="DSCF3116.jpg" onclick="func1(1);" style="width: 150px; height: 150px">
</p>
</body>
</html>

and my second form:

<html>
<head>
<title>ShowImage.php</title>
</head>

<body>
<?php
$Pict = $_REQUEST["pict"];
print("<h1> $Pict </h1>");
?>
</body>
</html>

Clicking on a thumbnail transfers to the new page, but I get a message:

Notice: Undefined index: pict in C:\xampp\htdocs\Bk05Ch06\ShowImage.php on line 11

How do I get the variable "pict" transferred to the new page?

Thanks.

See more: free ringtone download | free ringtones, download message tones

Last edited by alexwaston; 02-22-2017 at 09:38 PM..
alexwaston is offline   Reply With Quote

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfer Switch Market Aadolf General Discussion 1 04-02-2016 02:04 AM
RankFirstHosting.Com | Great Range of Cheap Shared SEO Hosting Plans with High Uptime rf-harris Post your ad here 0 03-22-2016 03:53 AM
SEO Backend Form ? Ruby707 Search Engine Optimization 1 06-18-2015 05:27 AM
Airport Transfer in Turkey rummy26 Post your ad here 1 04-10-2014 04:45 AM
Contact form script problems ncjbhd HTML / DHTML 0 10-24-2011 08:42 PM


All times are GMT -7. The time now is 03:02 PM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.