Form Sending

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shaun Demellweek

    Form Sending

    When you use a form to insert data into a MySQL database, how can you
    set it up so that the fields are not sent via the address bar.

    For example:

    page1.php
    ___________
    <form action="page2.p hp">
    <input type="text" value="whatever ">
    <input type="submit" value="Send">


    page2.php
    ___________
    // Inserts variable $whatever into database.

    The problem that I have is that I don't want the address bar to appear
    as http://web/page2.php?whatever=cheese but as http://web/page2.php

    Any ideas?

    Many thanks in advance
    Shaun Demellweek
  • Kolja Engelmann

    #2
    Re: Form Sending

    write this:
    <form action="page2.p hp" method = "post">

    Kolja

    Comment

    • Michael J. Astrauskas

      #3
      Re: Form Sending

      Shaun Demellweek wrote:
      [color=blue]
      > When you use a form to insert data into a MySQL database, how can you
      > set it up so that the fields are not sent via the address bar.
      >
      > For example:
      >
      > page1.php
      > ___________
      > <form action="page2.p hp">
      > <input type="text" value="whatever ">
      > <input type="submit" value="Send">[/color]

      Change the first line here to read:

      <form action="page2.p hp" method="POST">
      [color=blue]
      > page2.php
      > ___________
      > // Inserts variable $whatever into database.
      >[/color]

      Then to get the variables here you can use
      $whatever = $_POST["whatever"];

      Or you can import all POST variables via import_request_ variables
      (http://www.php.net/manual/en/functio...-variables.php) or
      $_REQUEST
      (http://www.php.net/manual/en/reserve...ables.request).

      I recommend the second option:
      import_request_ variables("P"," p_");

      This will import all variables from the form and name them $p_whatever.

      --
      - Michael J. Astrauskas

      Comment

      • Randell D.

        #4
        Re: Form Sending


        "Shaun Demellweek" <shaun@shaund.c om> wrote in message
        news:37b99ead.0 309240409.2eb71 4e1@posting.goo gle.com...[color=blue]
        > When you use a form to insert data into a MySQL database, how can you
        > set it up so that the fields are not sent via the address bar.
        >
        > For example:
        >
        > page1.php
        > ___________
        > <form action="page2.p hp">
        > <input type="text" value="whatever ">
        > <input type="submit" value="Send">
        >
        >
        > page2.php
        > ___________
        > // Inserts variable $whatever into database.
        >
        > The problem that I have is that I don't want the address bar to appear
        > as http://web/page2.php?whatever=cheese but as http://web/page2.php
        >
        > Any ideas?
        >
        > Many thanks in advance
        > Shaun Demellweek[/color]

        There are different methods to process your form - specifically, POST and
        GET and I think you are using GET (which will limit form data I think to
        1024 characters)... I suggest you change to POST to resolve your problem in
        addition, to allowing you to pass more content, either now, or the future...
        You can do this by adding METHOD=POST inside your <FORM> tag.


        Comment

        Working...