473,503 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help please with inputting and then passing parameters

I want the visitor to enter three numbers on the page and then click a
button "generate image" which will I hope cause a generated gif image to be
displayed alongside on the page.

This involved a php page elsewhere which does all the computing of the gif
image. I can make this work successfully by using a static call like:
<img src="test12.php?a=15&b=65&c=33000" width="200" height="200">

How do I write javascript to allow the visitor to enter 3 numbers and, when
ready, click a button to send a request to calculate
test12.php?a=15&b=65&c=33000 and display the new gif on the same page,
ideally with the option to edits the numbers and click again for different
image ?

Best regards, Eric.
Jul 23 '05 #1
6 1622
Lee
Eric Johnston said:

I want the visitor to enter three numbers on the page and then click a
button "generate image" which will I hope cause a generated gif image to be
displayed alongside on the page.

This involved a php page elsewhere which does all the computing of the gif
image. I can make this work successfully by using a static call like:
<img src="test12.php?a=15&b=65&c=33000" width="200" height="200">

How do I write javascript to allow the visitor to enter 3 numbers and, when
ready, click a button to send a request to calculate
test12.php?a=15&b=65&c=33000 and display the new gif on the same page,
ideally with the option to edits the numbers and click again for different
image ?


You don't really want to use Javascript for that. You want to learn
about form processing in PHP. This isn't the correct newsgroup for that.

Jul 23 '05 #2

So, what do you need, data validation or...? I mean, you didn't quite
state your question, you need 3 numbers? use a Form and field elements,
plain HTML.

Danny


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #3
Lee wrote:
Eric Johnston said:

I want the visitor to enter three numbers on the page and then click
a button "generate image" which will I hope cause a generated gif
image to be displayed alongside on the page.

This involves a php page elsewhere which does all the computing of
the gif image. I can make this work successfully by using a static
call like: <img src="test12.php?a=15&b=65&c=33000" width="200"
height="200">

How do I write javascript to allow the visitor to enter 3 numbers
and, when ready, click a button to send a request to calculate
test12.php?a=15&b=65&c=33000 and display the new gif on the same
page, ideally with the option to edit the numbers and click again
for different image ?


You don't really want to use Javascript for that. You want to learn
about form processing in PHP. This isn't the correct newsgroup for
that.


Many thanks Danny and Lee

I am not attempting validation at this stage.
I have just made an html form and elements. The three numbers come in OK
( I can multiply them etc and display a total for example) but can't output
the three number variables as url link parameters:
This does not work:
document.write('<img
src="test12.php?a=form.a.value&b=form.b.value&b=fo rm.c.value" width="200"
height="200"></td>');
It just sends out the text names of the variables like
"test12.php?a=form.a.value etc", even when form.a.value=15

On the other hand this static experiment does work
//document.write('<img src="test12.php?a=15&b=25&c=33000" width="200"
height="200"></td>');
Unfortunately this deletes the existing browser page creates a blank brower
page with the new gif instead of putting the gif into the existing page.
Solving that will be the next problem after I've got the variables going
into the parameters.

Is it possible to avoid javascript ? Does some html command allow you to
put form variables on the end of a url link that will call a gif?

I've tried doing html form method=post and can successfully transfer all the
variables to the php page and process the data in the php, but the result is
to give control to the php page rather than simply getting the php page to
return only a gif file. I want the new gif to appear back on the original
page alongside the 3 input numbers to give the visitor a chance to review
the image and try other numbers.

At the moment I have two pages. An html page (with embedded javascript, if
needed) that displays the input number boxes and a php page that takes in
three numbers and return a gif. I want the gif back on the html input page
ready for another go. If my concept is wrong please say.

Best regards, Eric.
Jul 23 '05 #4
Lee
Eric Johnston said:

Lee wrote:
Eric Johnston said:

I want the visitor to enter three numbers on the page and then click
a button "generate image" which will I hope cause a generated gif
image to be displayed alongside on the page.

This involves a php page elsewhere which does all the computing of
the gif image. I can make this work successfully by using a static
call like: <img src="test12.php?a=15&b=65&c=33000" width="200"
height="200">

How do I write javascript to allow the visitor to enter 3 numbers
and, when ready, click a button to send a request to calculate
test12.php?a=15&b=65&c=33000 and display the new gif on the same
page, ideally with the option to edit the numbers and click again
for different image ?
You don't really want to use Javascript for that. You want to learn
about form processing in PHP. This isn't the correct newsgroup for
that.


Many thanks Danny and Lee

At the moment I have two pages. An html page (with embedded javascript, if
needed) that displays the input number boxes and a php page that takes in
three numbers and return a gif. I want the gif back on the html input page
ready for another go. If my concept is wrong please say.


Your form should have the ACTION attribute set to the URL of
your PHP page. The PHP page can then receive the values directly
from the form, instead of from the URL. That's what PHP form
processing is all about.

Jul 23 '05 #5
Lee wrote:
Eric Johnston said:

Lee wrote:
Eric Johnston said:

I want the visitor to enter three numbers on the page and then
click a button "generate image" which will I hope cause a
generated gif image to be displayed alongside on the page.

This involves a php page elsewhere which does all the computing of
the gif image. I can make this work successfully by using a static
call like: <img src="test12.php?a=15&b=65&c=33000" width="200"
height="200">

How do I write javascript to allow the visitor to enter 3 numbers
and, when ready, click a button to send a request to calculate
test12.php?a=15&b=65&c=33000 and display the new gif on the same
page, ideally with the option to edit the numbers and click again
for different image ?

You don't really want to use Javascript for that. You want to learn
about form processing in PHP. This isn't the correct newsgroup for
that.


Many thanks Danny and Lee

At the moment I have two pages. An html page (with embedded
javascript, if needed) that displays the input number boxes and a
php page that takes in three numbers and return a gif. I want the
gif back on the html input page ready for another go. If my concept
is wrong please say.


Your form should have the ACTION attribute set to the URL of
your PHP page. The PHP page can then receive the values directly
from the form, instead of from the URL. That's what PHP form
processing is all about.


Yes, I have made the html action work OK, but doing that gives control to
the php page and I was wanting the php page to return only the gif which
would display itself in the original html page. If it is not possible to do
what I suggest with javascript I may try to use one big php page that keeps
reproducing itself each time the visitor enters new variables.

Thanks, Eric.
Jul 23 '05 #6
"Eric Johnston" <no****@redyonder.co.uk> wrote in message
news:Al********************@fe3.news.blueyonder.co .uk...
I want the visitor to enter three numbers on the page and then click a
button "generate image" which will I hope cause a generated gif image
to be displayed alongside on the page.

This involved a php page elsewhere which does all the computing of the
gif image. I can make this work successfully by using a static call
like:
<img src="test12.php?a=15&b=65&c=33000" width="200" height="200">

How do I write javascript to allow the visitor to enter 3 numbers and,
when ready, click a button to send a request to calculate
test12.php?a=15&b=65&c=33000 and display the new gif on the same page,
ideally with the option to edits the numbers and click again for
different image ?


<img src="blank.gif" name="myImage" width="200" height="200">
<form name="myForm" action="post" onsubmit="return false;">
<input type="text" name="a">
<input type="text" name="b">
<input type="text" name="c">
<input type="button" name="btn" value="Update image"
onclick="updateImage(this.form);">
<script type="text/javascript">
function updateImage(f)
{
var img;
if (f && (f = f.elements) &&
(img = document.images) &&
(img = img['myImage'])
{
img.src = 'test.php' +
'?a=' + f['a'].value +
'&b=' + f['b'].value +
'&c=' + f['c'].value;
}
}
</script>
</form>

Then test.php would use ImageMagick to do something like the following.
This is a shell script, but you could either get PHPMagick, or shell out
from PHP to invoke 'convert':

#!/usr/bin/sh
echo "Content-type: image/gif"
echo ""
# retrieve the values of a, b and c from
# $QUERY and calculate the $answer
/usr/local/bin/convert \
-background '#000000FF' -fill '#0000000' \
-pointsize 12 label:"$answer" \
gif:-

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
1551
by: Radith | last post by:
HI all; I have created a program just to get an understanding of strcpy. (still an amateur developer). I use scanf("%s", &first) in order to get the input to the variable first (which is char...
4
2647
by: DOTNET | last post by:
Hi, Anybody help me regarding this error: I am assigning the values to the session variables when the button is clicked and passing these session variables to the next page and when I am...
4
2443
by: Warren Sirota | last post by:
Hi, Please let me know if I am interpreting this correctly. I've done a little testing of the difference between passing parameters byVal and byRef, and the results were slightly non-intuitive,...
0
300
by: Warren Sirota | last post by:
Hi, Please let me know if I am interpreting this correctly. I've done a little testing of the difference between passing parameters byVal and byRef, and the results were slightly non-intuitive,...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7348
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7006
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5592
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5021
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
1
744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
397
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.