Results 1 to 5 of 5

Thread: Variable value for form text...

  1. #1
    Registered
    Join Date
    Aug 2003
    Location
    Columbus, Ohio
    Posts
    122

    Variable value for form text...

    Folks,

    Is there any way that I can assign a link to hold value with or putting it into a form so all my users have to do is click on a link and the receiving php script will process the link in itself ($_SERVER('$_SELF')) as a variable? I don't want to require user input, bar the click on the link, in order to perform a search...

    ERIC

  2. #2
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,049
    Its called a query string.

    http://www.example.com/script.php?va...able2=whatever

    For methods on taming query strings see here:

    http://www.websitepublisher.net/arti...friendly_urls/
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

  3. #3
    Registered
    Join Date
    Aug 2003
    Location
    Columbus, Ohio
    Posts
    122
    OK, now that really helped me out a ton, but I need to do the same thing when processing a form. What I need to do now is to have the user submit search criteria info into a text box, but when information appears I need it to list ordered by criteria first then barcode. This is the end of my conditional.

    else {
    $mod = $_POST['model'];
    }

    $query = "SELECT barcode, serial_number, location, manufacturer, model, item, item_type FROM invtemp WHERE model LIKE '%$mod%' ORDER BY barcode";

    $result = mssql_query( $query );

    Along with a "model" search, I have 3 other forms on my search page. I can do this pretty easily using 4 different scripts, but that defeats the purpose. Is there a way that I can append a variable for "model" in this case when submitting via a form? I'd like it to read,

    else {

    $var = $criteria

    $var2 = $_POST['$var'];
    }

    $query = "SELECT barcode, serial_number, location, manufacturer, model, item, item_type FROM invtemp WHERE $var LIKE '%$var2%' ORDER BY $var, barcode";

    $result = mssql_query( $query );

    ...to make it more generic, but I'm not sure how to define $criteria as "model"...or "item" or "location" or whatever the case...I need it to be done when the form is submitted. Any ideas?

    ERIC

  4. #4
    Registered
    Join Date
    Aug 2003
    Location
    Columbus, Ohio
    Posts
    122
    OK, I'm an idiot...all I had to do was include the query string on my action link!

    K, next...if anyone cares...

    I am returning data to be displayed by rows. Each row returned has an identifier (barcode). I need to be able to have the users click on the identifier of each returned row that will bring up editible properties of the selected row. I need to know how to manipulate the variables in this case to put hyperlinks on each returned object in my "barcode" field. Anyone?

  5. #5
    Administrator Chris's Avatar
    Join Date
    Feb 2003
    Location
    East Lansing, MI USA
    Posts
    7,049
    What is your primary key?

    A link like:

    <a href = "edit.php?id=primarykey">

    usually works.
    Chris Beasley - My Guide to Building a Successful Website[size=1]
    Content Sites: ABCDFGHIJKLMNOP|Forums: ABCD EF|Ecommerce: Swords Knives

Similar Threads

  1. Is there any recommended length for alt text?
    By sitepointRefugee in forum Search Engine Optimization
    Replies: 4
    Last Post: 03-27-2004, 02:36 AM
  2. Image rather than Text?
    By iKwak in forum Search Engine Optimization
    Replies: 8
    Last Post: 03-06-2004, 09:12 AM
  3. Multiple links and link text
    By r2d2 in forum Search Engine Optimization
    Replies: 2
    Last Post: 02-17-2004, 07:40 PM
  4. Does google care about a text link the same color as the text
    By Apollo in forum Search Engine Optimization
    Replies: 6
    Last Post: 12-30-2003, 10:42 AM
  5. How much text is indexed by search engines?
    By flyingpylon in forum Search Engine Optimization
    Replies: 2
    Last Post: 12-22-2003, 09:07 PM

Bookmarks

Posting Permissions

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