Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Search page/box to results page

Options
  • 27-01-2009 10:40pm
    #1
    Closed Accounts Posts: 73 ✭✭


    How does the results page collect the information from the search page?


Comments

  • Registered Users Posts: 177 ✭✭mercuroman


    Where? What Page? ha?


  • Closed Accounts Posts: 30 codecrunchers


    I second mercuroman

    Where? What Page? ha?


  • Closed Accounts Posts: 73 ✭✭Protype


    When the information is sent to the search page do i need to declare in variables the values from the fields in the search page.


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    What language are you using?

    Your form in the search page would have an action attribute that specifies the results page. Your results page can then access the form elements.

    An ASP example:

    search.asp:

    [html]
    <form name="frmSearch" method="post" action="results.asp">
    <input type="text" name="txtFirstName" />
    <input type="text" name="txtLastName" />
    <input type="submit" />
    </form>
    [/html]

    When the form is submitted, it will automatically call "results.asp", which might have something like this:
    Dim firstname, lastname
    firstname = Request.Form("txtFirstName")
    lastname = Request.Form("txtLastName")
    Response.Write "You searched for first name: " & firstname & " and last name: " & lastname
    

    You can then use these variables to build up your search criteria. Until you give a lot more details, it's impossible to help you out any more than that.


  • Closed Accounts Posts: 73 ✭✭Protype


    Using php

    AHHHHHHH

    This is what i needed to know
    firstname = Request.Form("txtFirstName")
    lastname = Request.Form("txtLastName")

    I am only learning and thanks for you time.


  • Advertisement
  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    No probs - you're using ASP, right?


  • Closed Accounts Posts: 73 ✭✭Protype


    eoin wrote: »
    No probs - you're using ASP, right?

    What i use is

    Dreamweaver
    MySQL
    php


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    OK, the syntax is different then. I don't know php, but I think it's something like this:

    [php]
    $firstname= $_REQUEST ;
    $lastname = $_REQUEST ;
    [/php]


  • Registered Users Posts: 2,494 ✭✭✭kayos


    Ba I really should have read the whole thread....


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    Yep, as I said earlier that was an ASP example. And just above your post is what I think is the PHP syntax.


  • Advertisement
  • Closed Accounts Posts: 73 ✭✭Protype


    Hi Eoin

    Ye that is what was wrong. I did not know if i needed the $_REQUEST for the script to run.

    I Have another question if you don't mind!

    How do i send only a image path to a database?


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    I am guessing you want to upload an image to a folder on the website as part of the form, but only store the filename in the database? Number of ways you can do this, but unfortunately my knowledge of PHP is non-existent!


  • Closed Accounts Posts: 73 ✭✭Protype


    eoin wrote: »
    I am guessing you want to upload an image to a folder on the website as part of the form, but only store the filename in the database? Number of ways you can do this, but unfortunately my knowledge of PHP is non-existent!

    Yes this is what i trying to do.

    I got the "move file" sorted, so this is fine
    But when storing information in the database i send the form. in the form i have file fields and what i need is to only store the file path and not the file its self.

    Any idea??

    Thanks for you help


  • Registered Users Posts: 21,257 ✭✭✭✭Eoin


    Somewhere in the upload process, you'll be able to get the filename of the file that's just been uploaded, so just set a variable there and use that value for the form.


  • Registered Users Posts: 5,618 ✭✭✭Civilian_Target


    It goes something like this...

    Page:
    <html><body><form method="post" action="upload.php">
    <input type="file" name="myFile" />
    </form></body></html>
    

    upload.php in the same folder
    <?php
    move_uploaded_file($_UPLOAD['myFile']['tmpname'], "savedfile.jpg");
    fopen("savedfile.jpg") or die("Couldn't open the saved file");
    print "File uploaded"; ?>
    


  • Closed Accounts Posts: 73 ✭✭Protype


    Sorted

    Thanks to all


Advertisement