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.