Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2006
    Thanked 0 Times in 0 Posts

    Question Empty GET variables (PHP + JS)


    I have a search form that uses get variables, and will not use post variables, and I have some optional options that still pass empty variables. The search form is located at http://www.rentalnook.com/search.php. If you click advanced options you will see the drop downs that I have, and I want to make it so that I can unset the get variables when the form is submitted. I know this is possible because I already have a PHP function that a.) takes all the GET variables and echos them (for links) and b.) unsets any GET variable. The problem is the JavaScript part, because there isn't a Javascript equivalent to this function because of the necessary server-side functions and variables. I was thinking that I make a javascript function that checked blank values for those drop down boxes and either a.) manually "submitted" the form, by taking every non-blank variable and just do a location.href='results.php?firstvar=1...' or b.) call that function before the submit button somehow. But I would need to take variables from Javascript to PHP easily. That is what I feel would be the easiest, and most efficient way. aThanks for any help.

  • #2
    Regular Coder
    Join Date
    Jul 2007
    Thanked 14 Times in 14 Posts
    I don't understand what you are trying to achieve, is it some kind of form validation?

    There is an "onsubmit" attribute for a form that is used to call a javascript function. This function can do anything you like and then decide whether of not to actually send the form or not. Is this what you're after?


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts