Loading ...
Sorry, an error occurred while loading the content.

PHP Script For Site Search

Expand Messages
  • Ray Shapp
    Hello All, I d like to place a pull-down search window on my home page which will list about a hundred terms in an alphabetical list. When the user clicks on a
    Message 1 of 10 , Sep 14, 2006
    • 0 Attachment
      Hello All,

      I'd like to place a pull-down search window on my home page which will list
      about a hundred terms in an alphabetical list. When the user clicks on a term
      such as "Directions" or "Map", a hyperlink will take him/her to the relevant
      webpage on my site. I want to use this as a learning experience for PHP
      scripting. So far, I have worked the basic tutorial on the official PHP site
      ( http://www.php.net/ ) and I have scanned several of the free script
      repositories. Can anyone point me to a PHP script that will present a
      pull-down list of hyperlinks?

      I have already installed the Google search tool on my site. It's fine for
      free-form search of my site. I now want to provide links to specific pages in
      a list of my choosing. This will be a sort of super index page.

      Thanks for the help.

      Ray Shapp
    • loro
      ... With reservations for that I really don t know PHP, you don t need much of a script for that. PHP (script.php):
      Message 2 of 10 , Sep 14, 2006
      • 0 Attachment
        Ray Shapp wrote:
        >I'd like to place a pull-down search window on my home page which will list
        >about a hundred terms in an alphabetical list. When the user clicks on a term
        >such as "Directions" or "Map", a hyperlink will take him/her to the relevant
        >webpage on my site. I want to use this as a learning experience for PHP
        >scripting. So far, I have worked the basic tutorial on the official PHP site
        >( http://www.php.net/ ) and I have scanned several of the free script
        >repositories. Can anyone point me to a PHP script that will present a
        >pull-down list of hyperlinks?

        With reservations for that I really don't know PHP, you don't need much of
        a script for that.

        PHP (script.php):
        <?php
        header("location:http://" . $_GET['whereto']);
        exit;
        ?>

        HTML
        <form action="script.php" method="get">
        <select name="whereto">
        <option value="google.com">Search the Web</option>
        <option value="notetab.com">Text editor</option>
        <input type="submit">
        </select>
        </form>

        Lotta
      • loro
        Oops! Typed too fast and got the select button nested in the select. ...
        Message 3 of 10 , Sep 14, 2006
        • 0 Attachment
          Oops! Typed too fast and got the select button nested in the select.

          ><option value="notetab.com">Text editor</option>
          ><input type="submit">
          ></select>
          ></form>


          <form action="script.php" method="get">
          <select name="whereto">
          <option value="google.com">Search the Web</option>
          <option value="notetab.com">Text editor</option>
          </select>
          <input type="submit">
          </form>

          Lotta
        • Ray Shapp
          Hi Lotta, Thanks for the reply. I already have the Google tool running on the website. what I want to do is to make up a list of about a hundred hyperlinks to
          Message 4 of 10 , Sep 15, 2006
          • 0 Attachment
            Hi Lotta,

            Thanks for the reply.

            I already have the Google tool running on the website. what I want to do is to
            make up a list of about a hundred hyperlinks to various pages on my site, and
            provide a drop-down window where a user could click on one of the links to go
            to desired parts of my site.

            As an example, the following website implemented this idea using JavaScript. I
            want to do it in PHP. See http://www.princetonastronomy.org/

            They have the search tool listed under "Site map"

            Ray Shapp
          • loro
            ... I understood that. My links were meant as examples. Build the select box with whatever links you want. Or did I misunderstand and you want PHP to generate
            Message 5 of 10 , Sep 15, 2006
            • 0 Attachment
              Ray Shapp wrote:
              >I already have the Google tool running on the website. what I want to do
              >is to
              >make up a list of about a hundred hyperlinks to various pages on my site, and
              >provide a drop-down window where a user could click on one of the links to go
              >to desired parts of my site.

              I understood that. My links were meant as examples. Build the select box
              with whatever links you want.

              Or did I misunderstand and you want PHP to generate link to all pages at
              your site?

              Lotta
            • Ray Shapp
              Hi Lotta, I haven t replied because I m still reading about how forms work in HTML. The links in the pull-down windows are not active. IOW, clicking on any one
              Message 6 of 10 , Sep 18, 2006
              • 0 Attachment
                Hi Lotta,

                I haven't replied because I'm still reading about how forms work in HTML. The
                links in the pull-down windows are not active. IOW, clicking on any one of
                them does not launch the specified page.

                Thanks for your help.

                Ray Shapp
                ******************************************

                You said:

                I understood that. My links were meant as examples. Build the select box
                with whatever links you want.

                Or did I misunderstand and you want PHP to generate link to all pages at
                your site?

                Lotta
              • David Smart
                You need to look at the HTML that goes to the browser - i.e. do a view source. If the links aren t working, then presumably the generated HTML is wrong. Once
                Message 7 of 10 , Sep 18, 2006
                • 0 Attachment
                  You need to look at the HTML that goes to the browser - i.e. do a view
                  source. If the links aren't working, then presumably the generated HTML is
                  wrong.

                  Once you've found what's wrong with the generated HTML, you can look at
                  fixing the PHP that generates it.

                  Regards, Dave S

                  ----- Original Message -----
                  From: "Ray Shapp" <ras45@...>
                  To: <ntb-OffTopic@yahoogroups.com>
                  Sent: Monday, September 18, 2006 6:14 PM
                  Subject: Re: [NTO] PHP Script For Site Search - correction


                  > Hi Lotta,
                  >
                  > I haven't replied because I'm still reading about how forms work in HTML.
                  > The
                  > links in the pull-down windows are not active. IOW, clicking on any one of
                  > them does not launch the specified page.
                  >
                  > Thanks for your help.
                  >
                  > Ray Shapp
                  > ******************************************
                  >
                  > You said:
                  >
                  > I understood that. My links were meant as examples. Build the select box
                  > with whatever links you want.
                  >
                  > Or did I misunderstand and you want PHP to generate link to all pages at
                  > your site?
                  >
                  > Lotta
                  >
                  >
                  >
                  >
                  >
                  >
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                • Hugo
                  Ray, Maybe this page will help you further... http://members.aol.com/grassblad/html/selMenu.html Hugo
                  Message 8 of 10 , Sep 18, 2006
                  • 0 Attachment
                    Ray,

                    Maybe this page will help you further...

                    http://members.aol.com/grassblad/html/selMenu.html

                    Hugo

                    Ray Shapp wrote:
                    > Hi Lotta,
                    >
                    > I haven't replied because I'm still reading about how forms work in HTML. The
                    > links in the pull-down windows are not active. IOW, clicking on any one of
                    > them does not launch the specified page.
                    >
                    >
                  • loro
                    ... No, that s JavaScript behavior. There isn t (can t be) any true links in the select box. A form needs to be properly submitted if JS doesn t intervene.
                    Message 9 of 10 , Sep 18, 2006
                    • 0 Attachment
                      Ray Shapp wrote:
                      >I haven't replied because I'm still reading about how forms work in HTML. The
                      >links in the pull-down windows are not active. IOW, clicking on any one of
                      >them does not launch the specified page.

                      No, that's JavaScript behavior. There isn't (can't be) any true links in
                      the select box. A form needs to be properly submitted if JS doesn't
                      intervene. Personally I don't like the jump version, because I tend to
                      click when I don't mean to and then I have to go back and do it all over.
                      Apart from that there's no reason you can't combine the two. If JS is
                      available it does its thing and the form is never submitted. If JS isn't
                      available the form works because of the server-side script. You could even
                      hide the submit button with JS and people with JS available will never see it.
                      <http://www.cs.tut.fi/~jkorpela/forms/navmenu.html#comb>

                      Lotta
                    • loro
                      ... There is no generated HTML. Ray wanted the form to work as a JavaScript jump box does, i.e. without having to use the submit button. But a it can t do
                      Message 10 of 10 , Sep 19, 2006
                      • 0 Attachment
                        David Smart wrote:
                        >You need to look at the HTML that goes to the browser - i.e. do a view
                        >source. If the links aren't working, then presumably the generated HTML is
                        >wrong.
                        >
                        >Once you've found what's wrong with the generated HTML, you can look at
                        >fixing the PHP that generates it.

                        There is no generated HTML. Ray wanted the form to work as a JavaScript
                        "jump box" does, i.e. without having to use the submit button. But a it
                        can't do that, not without JavaScript.

                        Lotta
                      Your message has been successfully submitted and would be delivered to recipients shortly.