php + javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yaniv
    New Member
    • Apr 2007
    • 3

    #1

    php + javascript

    hi
    first let me say that im not a php programmer (till now all i did was asp)
    i realize that php is kinda easy to understand and im giving it a shot...
    so please be patience... (-:
    i want to do this:
    take varible from a url, in asp i could use request.queryst ring but i understand that its not safe to use it with php (i have to register_global s=on) so i decided to listen and not to use it.
    i cant use a form.
    so i thought using javascript, take the var from the url put it in a javascript function and then send it to the php function.
    or maybe there is a better way to this....
    can you guys give some directions or a function the does this
    thank you
    Yaniv
  • yaniv
    New Member
    • Apr 2007
    • 3

    #2
    maybe more details...
    i want this:
    <a href="www.myDom ain.com/index.php?id=XX X" target="_blank" >TEST</a>
    in the index.php, use the "id" value

    Comment

    • ak1dnar
      Recognized Expert Top Contributor
      • Jan 2007
      • 1584

      #3
      Originally posted by yaniv
      hi
      first let me say that im not a php programmer (till now all i did was asp)
      i realize that php is kinda easy to understand and im giving it a shot...
      so please be patience... (-:
      i want to do this:
      take varible from a url, in asp i could use request.queryst ring but i understand that its not safe to use it with php (i have to register_global s=on) so i decided to listen and not to use it.
      i cant use a form.
      so i thought using javascript, take the var from the url put it in a javascript function and then send it to the php function.
      or maybe there is a better way to this....
      can you guys give some directions or a function the does this
      thank you
      Yaniv
      Using the register_global s=on is a default feature with the modern PHP versions.How ever there are lots of ways to do what ever you need.

      You can use sessions to pass the variables with your application.Giv e it a try by using this Tutorials.
      W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.



      And according to your suggestion,if you familiar with JS that also possible, with some ajax.
      Read thisThread you will get a answer. here no need of ajax. try to find out it by your self.

      Comment

      • mihai123
        New Member
        • Mar 2007
        • 13

        #4
        if the address is this index.php?id=va lue

        then the variable id could be use like this $_GET['id']
        if you want to read all the query string (variable and their values) you can use $_SERVER['QUERY_STRING']

        no need to use javascript for this even if safe mode is enable.

        also if you use the method post you can use the variabla with this syntax $_POST['variable']

        Comment

        • yaniv
          New Member
          • Apr 2007
          • 3

          #5
          hi
          first thanks for your replies!

          you mean:
          the url is ....index.php?i d=XXX
          and in the index.php i do $_GET[id] and i will get the XXX?

          Comment

          Working...