Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Radio Button, open url?! :(

    Hey.

    Im new here and a total newb at scriping =D

    Right this is what im trying to do.
    I want to make a radio button connected to a text box.

    Say the button 'define' has been clicked, and in the text box 'php' has been written in, it should go to google where 'define: php' has been written in and searched.

    This is what i have done so far:

    Code:
    <input type="radio" name="engine" id="engine" value="define" CHECKED> <b>Define<\/b>
    and

    Code:
    <form name="example" style="margin:-10 0 5 10" id="example" action=
        "somephpradiobutton-if-response" method="post" target="_blank">
          <br>
          <input type="text" name="search" id="search" maxlength='60' size='45' value=""> <input type=
          "submit" value="Search"><br>
          <br>
    
          <div id="heh"></div><script type="text/javascript">
    foo(search);
    </script>
        </form>

    But i do not know what type of response script would be in the action=
    "somephpradiobutton-if-response"


    something like ' if define, then go to this url:....'

    could anyone give me an example what would be in response.php script with the data i have given above?
    I have searched ALOT but all i find is alert boxes that open giving a message, and 'sql' or something like that

    Thankyou in advanced!

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
    <html>
     <head>
      <title>search</title>
    <script type="text/javascript">
    function transform(frm) {
    	var engine = frm.engine.checked;
    	var search = frm.search.value;
    	if ( engine ) {
    		frm.q.value = 'define:' + search;
    		frm.engine.checked = false;
    	}
    }
    </script>
     </head>
     <body>
      <form name="example" style="margin:-10 0 5 10" id="example" action=
        "http://www.google.com/search" method="get" target="_blank" onsubmit="transform(this)">
          <br>
          <input type="text" name="search" id="search" maxlength='60' size='45' value=""> 
    	  <input type="submit" value="Search"><br>
    	  <input type="text" name="q"></input>
          <br>
           <input type="radio" name="engine" id="engine" value="define" > <b>Define</b>
          <div id="heh"></div>
        </form>
     </body>
    </html>
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • #3
    New to the CF scene
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi.

    Thank you for your reply.
    Thats cool script =D appritiat your work.

    I just have 1 tiny mumble I have written most of the code already and that sorta doesnt fit in my answere

    Here is a copy of source i have
    Code:
    http://www.blizma.co.uk/googleproject/project.txt
    I got that source mainly from
    Code:
    jimmyr.com
    and wanna make something simular.

    After ages of googling i found something like this which i can write in the response.php

    Code:
    $toDefine = $_POST['the_name_of_the_text_box'];
    Could you help me on that?


  •  

    Posting Permissions

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