Hi All,
I am writing some screen strictly in PHP. I have a screen with a
combo box in it. I do not want to use forms, just links on the page.
What I want to do, is when the user selects the value from the combo
box, and clicks on the link, I want the value in the combo box to be
passed as a parameter to another PHP page, and be used in that page.
I really want to avoid forms and the whole GET/POST stuff.
Why?
You only need declare a form, so that yu can send post and get variables
with the program.
You don't even need a submit button, you write minimal javascript the
uses onclick() to set up hidden variables and send the form back ..then
you pick the values in those up as post or get variables.
You don't even need a form, you can use the
<A HREF= "Mystuff.php?button5='clicked'">THIS IS BUTTON5</A>
and have mystuff.php do
$button5=$_GET['button5'];
if($button5=='clicked')
......etc;
Is there any way to do this? Javascript maybe? I'm terrible at
Javascript, so if this is the way, if you could include and example,
I'd greatly appreciate it.
Theres anoyther way with javascript that I found when trying to do it
last night..you can chain to a page and set POST variables as you go.
But it looked more complicated than the ones above, so I gave up on it.
Bascally I know of three ways to chain ino a ew windows when yu clck on
something.
The <a> method, the <SUBMIT> button, or an onclick() method inside the
element.
I only know of two easy ways to carry DATA to the program. One is by the
program name itself, and the other is post or get variables.
Get variables dont require a <form> to be declared, you can encapsulate
them in a URL. Post methods are more secure, but do. But thats ALL you
have to do to use them. Declare a form and some hidden variables to put
them in.
Then use a minimal amount of javascript to set them
e.g.
my.php
======
<?php
$myvar=$_POST['myvar'];
?>
<HTML>
<HEAD>
</HEAD>
<BODY>
<script type="text/javascript" language="JavaScript">
function do_myvar()
{
document.getelementsByName('myvar')[0].value="YES!";
document.forms[0].submit();
}
</script>
YOU got here<?if($myvar=='YES!')
print " by clicking CLICK HERE text!";
else print " on yer own!!";
?>
<BR>
<FORM method="POST" enctype="multipart/form-data" action="my.php">
<input type="hidden" name="myvar" value=" <?$myvar?>">
<span onclick="do_myvar()">Click HERE</span>
</FORM>