Jump to content

button direction


CWeaver

Recommended Posts

I have two buttons on a page. One is the basic submit button that can pass the presented data on to the url specified in the <form> tag. The other button I would like to direct the visitor to another url with parameters, e.g.: SomeOtherPage.php?Var1=$VarData1&Var2=$VarData2I don't know how to do this with the attributes of the <button> tag, so I'm thinking that I should be doing it with some JavaScript. Any other ideas would be heartily welcomed.

Link to comment
Share on other sites

Jonas, are you sure about that? I thought it'd be:<input type="button" value="Click!" onclick="java script:window.location='your link here'">

Link to comment
Share on other sites

Jonas, are you sure about that? I thought it'd be:<input type="button" value="Click!" onclick="java script:window.location='your link here'">

I went with this:
onclick="javascript:window.location='TestimonialInput.php?Patient=$Patient&Testimonial=$Testimonial'"

And got to the page I wanted, but my parameters came through as literals. Are you conversant enough in PHP to see what I've done? I'm just getting started in this parameter passing business.

Link to comment
Share on other sites

Hehe, i'm at the same place you are in php. :)I don't understand. You're using a php page to go to another page and pass the variables of the current page to the next page?Hmm... your problem is is that this isn't INSIDE the php script. If it were between the <?php and ?> tags, it would work perfectly. But i'm guessing it's not inside the tags, so it's passing $thing instead of the VALUE of $thing. One way to do this is echo this inside the php and it should work. Do you understand what i mean? For example,<?php$thing = $_GET['thing'];echo $thing;?>Where 'thing' is the html to create your form.

Link to comment
Share on other sites

After I left to pick up lunch I thought of the answer:

onclick="javascript:window.location='TestimonialInput.php?Patient=<?php echo $Patient; ?>&Testimonial=<?php echo $Testimonial;?>'"

I'm extracting the parameters passed with this:

<?phpif (!isset($PHP_SELF)) {  function registerglobals($which){    global $$which;    if(isset($$which)){      if(is_array($$which)){        reset($$which);        while(list($key,$val)=each($$which)){          global $$key;          $$key=$val;        }      }    }  }  registerglobals("_GET");  registerglobals("_POST");  registerglobals("_COOKIE");  registerglobals("_SERVER");  registerglobals("_ENV");  registerglobals("_SESSION");}?>

It's in an include file that handles all of the calls. Thanks for the input. If it hadn't hit me in the face while making a left hand turn, your response would have done it for me.BTW, don't ever forget the ';' at the end of each php command. The nasty thing about leaving them out is that nothing happens. I would like to find a php syntax checker. Know of any?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...