PHP

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • how can I CALL a PHP script from different TEXT LINKS with differentPARAMETERS?

    7 answers - 699 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi,
    I'm not so keen on PHP (so on English :) ) and I have a little problem:
    the left side of the page there is the following menu:
    PRDUCTS
    Search
    Add
    MEMBERS
    Search
    Add
    RDERS
    Search
    Add
    Is that possible to link each "Search", "Add" to a "Search.php" and
    "Add.php" page and give a parameter to php script so as to make an "on
    the fly" "searchProducts.php" or "AddProducts.php" or
    "SearchMembers.php" etc?
    If I make individual "searchProducts.php" or "AddProducts.php" files
    these won't have many differences, so I Think it's better to make these
    on the fly.
    Any Idea?
    Thanks in advance.
    Christos Korakidis
  • No.1 | | 746 bytes | |

    11/19/05, Webmaster <webmaster (AT) lindworm (DOT) dewrote:
    You can send data to the next php file by HTTP-GET.
    Simply add a ? behind the link and then <variablename>=<value>.
    Example ./jumpto.php?to=searchProduct

    Well i think it was about the code inside the search/add/edit pages
    not how to reach them.
    If i understood correctly, you're trying to reduce the amount of code
    to write by applying a pice of common code on your objects
    (product/member/order) while adding specific functionality using a
    switche specifed as a paramter (?object=Product/Member/) It
    just all depends on "how common" are these operations that needed to
    be applied in each case so you knows that better
    -ahmed
  • No.2 | | 2384 bytes | |

    Webmaster, thanks very much but I think it would be safer to do that by
    post, not by get. Furthermore, if I use indivudual files
    ("searchProductInsertId.php", "searchMemberInsertId.php"), I think it
    is easy: in each link of the menu I can type:
    <a href="searchProductInsertId.php">Search</a>,
    <a href="searchMemberInsertId.php">Search</aetc.
    But, due to the fact that the html part of each SearchInsertId page
    doesn't have many differences between various search pages (in first
    case will show a message "type a productId to find" and will be
    connected with "searchProduct.php", in second case will show a message
    "type a memberId to find" and will be connected with "searchMember.php",
    and so on), I thought to make a searchSomethingWithId page, where the
    text and post php page will differentiate dependetly on what user had
    clicked on menu. So I think that the problem I have, is what exactly
    should be writen on each "Search", "Add" of menu so as to help the
    searchSomethingWithId page to understand what "search" or "add" was
    clicked, and secondly, what should be written on searchSomethingWithId
    page so as to call the appropriate "search" or "add" php page.
    I have some code about sessions and global values, I would preffer a
    solution involving global values if it is safe. I used in past forms and
    buttons to send information to php page but now I would like to use text
    links instead of buttons.

    I hope I helped you to understand and give me some help :)
    Thaks a lot!
    Korakidis Christos

    Webmaster wrote:
    Hi,
    i hope I got you right.

    You can send data to the next php file by HTTP-GET.
    Simply add a ? behind the link and then <variablename>=<value>.
    Example ./jumpto.php?to=searchProduct

    In the jumpto.php you would ask the Global Array for Get Variables for the
    entry and then decide what to do.

    Example:

    sf($_GET["to"] == "searchProduct"){
    header("Location: ./searchProduct.php");
    }

    if you have a lot of locations to jump to you could do that by case.

    switch($_GET["to"]){
    case "seachProduct":
    header("Location: ./searchProduct.php");
    break;
    case "seachMember":
    header("Location: ./searchMember.php");
    break;
    }

    I hope that helped.

    Greetings
    Mirco Blitz
  • No.3 | | 1824 bytes | |

    Ahmed thanks for your comments,
    the situation is that before calling "searchMember.php" or
    "searchProduct.php" or other, I need to give to user an interface where
    a message like "insert the Product/Member/ Id", then when he
    inserts and presses "find" the appropriate "searchSomething.php" page is
    called, depending on what whe had selected to search for.
    course I can make 3 individual pages ("SearchProductIsertId.php",
    "SearchMemberInsertId.php", "SInsertId.php"), where each page
    will call another page (e.g "SInsertId.php" ->
    "S"). This seems easier but if a change is needed in
    "SearchSomethingInsertId.php", I'll have to change all the 3 previous
    pages. Thus I thougt it would be better to make only one page for all
    searches.
    What is the common choice of experienced php devs in case of creating an
    administrative interface for various tables (e.g. products, members,
    orders etc)?

    Thanks,
    Christos Korakidis

    ahmed wrote:
    11/19/05, Webmaster <webmaster (AT) lindworm (DOT) dewrote:
    >>You can send data to the next php file by HTTP-GET.
    >>Simply add a ? behind the link and then <variablename>=<value>.
    >>Example ./jumpto.php?to=searchProduct


    Well i think it was about the code inside the search/add/edit pages
    not how to reach them.
    If i understood correctly, you're trying to reduce the amount of code
    to write by applying a pice of common code on your objects
    (product/member/order) while adding specific functionality using a
    switche specifed as a paramter (?object=Product/Member/) It
    just all depends on "how common" are these operations that needed to
    be applied in each case so you knows that better
    -ahmed
  • No.4 | | 831 bytes | |

    xkorakidis wrote:
    Webmaster, thanks very much but I think it would be safer to do that by
    post, not by get. Furthermore, if I use indivudual files

    It is a fallacy to ever tell someone that PST is safer than GET. They
    both transmit data in plaintext and it should not be assumed that either
    is inherently safer than the other, as this simply gives others a false
    sense of security.

    The difference between PST and GET lies in the semantics -- PST
    represents something changing on the server, e.g. updating a database
    field, and allows the browser to warn the user if they try to refresh.
    GET represents nothing of importance changing on the server, e.g.
    performing a search on the database, and can safely be repeated.

    SSL/TLS is the best option if you wish to transmit sensitive data.
  • No.5 | | 2604 bytes | |

    Thanks so much Mirco, but I would appritiate that very much if I had
    some examples. I'm not so keen in php, so some things seem to be complex
    for me. I downloaded SCommerce but the script pages aren't so simple
    for beginning
    So if you have something (code/url of examples) about this type of
    encryption-decryption and that type of programming you describe in next
    msg (classes, functions etc) plz send me. The only way I work until now
    is to call a php script page wich does an individual work. Guess that is
    the "jumpto" script?
    Thanks!

    Mirco Blitz wrote:
    HI,

    I totaly agree to Jaspers answer.

    Thats why I use NE jumpto script and GET.

    I usually encrypt the given Values I give over to the script and decrypt
    them on recive. That way nearly nobody can assume wich values are really
    given to the script.

    If you want to make it rocket safe, generate a random string that you place
    in a session variable for crypting and decrypting. By that way the value is
    different on every startup and you can be ure that you have made it when
    decrypting. If someone try's to use xsripting and try's to fool your script,
    latest the case structure yould not work, cause no plausible data is
    recived.

    But who would like to xscript on a jump page, it can't harm really.

    Greetings
    Mirco

    Nachricht
    Von: Jasper Bryant-Greene [mailto:jasper (AT) album (DOT) co.nz]
    Gesendet: Sonntag, 20. November 2005 04:12
    An: xkorakidis
    Cc: php-general (AT) lists (DOT) php.net
    Betreff: Re: AW: [PHP] how can I CALL a PHP script from different TEXT
    LINKSwith differentPARAMETERS?

    xkorakidis wrote:
    >>Webmaster, thanks very much but I think it would be safer to do that by
    >>post, not by get. Furthermore, if I use indivudual files


    It is a fallacy to ever tell someone that PST is safer than GET. They
    both transmit data in plaintext and it should not be assumed that either
    is inherently safer than the other, as this simply gives others a false
    sense of security.

    The difference between PST and GET lies in the semantics -- PST
    represents something changing on the server, e.g. updating a database
    field, and allows the browser to warn the user if they try to refresh.
    GET represents nothing of importance changing on the server, e.g.
    performing a search on the database, and can safely be repeated.

    SSL/TLS is the best option if you wish to transmit sensitive data.
  • No.6 | | 881 bytes | |

    Sun, Nov 20, 2005 at 04:12:05PM +1300, Jasper Bryant-Greene wrote:
    xkorakidis wrote:
    >Webmaster, thanks very much but I think it would be safer to do that by
    >post, not by get. Furthermore, if I use indivudual files


    The difference between PST and GET lies in the semantics -- PST
    represents something changing on the server, e.g. updating a database
    field, and allows the browser to warn the user if they try to refresh.
    GET represents nothing of importance changing on the server, e.g.
    performing a search on the database, and can safely be repeated.

    Another good reason to use PST to modify data, consider the link:

    If googlebot comes across your page containing a list of all your
    posts, with a link like that, you just might wake up one morning
    wondering why all your posts are gone.

    Curt.
  • No.7 | | 1345 bytes | |

    That's right Curt,
    this is the reason I characterised sending parameters via url not safe!
    But in case of selecting data, I think there is no problem to send data
    via url, right?
    anyway, I found more simple using PST in any case because I have
    already used that and works, so I prefer PST
    Thanks!

    Curt Zirzow wrote:
    Sun, Nov 20, 2005 at 04:12:05PM +1300, Jasper Bryant-Greene wrote:
    >>xkorakidis wrote:

    Webmaster, thanks very much but I think it would be safer to do that by
    post, not by get. Furthermore, if I use indivudual files
    >>The difference between PST and GET lies in the semantics -- PST
    >>represents something changing on the server, e.g. updating a database
    >>field, and allows the browser to warn the user if they try to refresh.
    >>GET represents nothing of importance changing on the server, e.g.
    >>performing a search on the database, and can safely be repeated.


    Another good reason to use PST to modify data, consider the link:

    If googlebot comes across your page containing a list of all your
    posts, with a link like that, you just might wake up one morning
    wondering why all your posts are gone.

    Curt.

Re: how can I CALL a PHP script from different TEXT LINKS with differentPARAMETERS?


max 4000 letters.
Your nickname that display:
In order to stop the spam: 8 + 7 =
QUESTION ON "PHP"

EMSDN.COM