+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: POST & GET methods did'nt work

  1. #1
    agmr559 is offline x10Hosting Member agmr559 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    5

    POST & GET methods did'nt work

    Hi friends

    I'm newby in this business, and I'm trying get variables from a HTML form.
    I tried GET and POST methods, but variables are not recognized in second PHP page, using $_GET and $_POST functions to work variables.
    Into localhost work fine, but in x10 don't work
    please some help

    regards
    A. Marambio

  2. #2
    Salvatos's Avatar
    Salvatos is offline x10 Lieutenant Salvatos is an unknown quantity at this point
    Join Date
    Jun 2006
    Location
    Québec, Canada
    Posts
    271

    Re: POST & GET methods did'nt work

    Hi, if you want us to be able to help you, you'll have to show us your code (make sure to remove sensitive information like passwords, if any) and point out to the part that doesn't work. Expected behaviour and actual behaviour also help understand the issue.

  3. #3
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: POST & GET methods did'nt work

    A. Copy of the form sending the information
    B. Copy of the script
    C. How do you know they are not working?
    Nothing is always absolutely so.

  4. #4
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: POST & GET methods did'nt work

    This can happen if you specify an incorrect form accept-charset. IE, using "UTF8" instead of "UTF-8". I think form encoding could cause the same problem, but I've never verified it.
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  5. #5
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: POST & GET methods did'nt work

    Note that full source code isn't necessary. More helpful is a minimal code sample, just enough code to be complete and to demonstrate the issue. To describe the problem clearly, state what you expect to happen and what actually happens (including any error messages).
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  6. #6
    abid_ml58 is offline x10Hosting Member abid_ml58 is an unknown quantity at this point
    Join Date
    Nov 2010
    Posts
    4

    Re: POST & GET methods did'nt work

    use
    echo post_r();

    on the display page

  7. #7
    agmr559 is offline x10Hosting Member agmr559 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    5

    Re: POST & GET methods did'nt work

    Hi, thanks for yours replays

    This is the sending html page:

    <BODY>
    <FORM METHOD="post" ACTION="send_simpleform.php">
    <P><strong>Su Nombre:</strong><br>
    <INPUT type="text" NAME="sender_name" SIZE=30></p>
    <P><strong>Su E-Mail Address:</strong><br>
    <INPUT type="text" NAME="sender_email" SIZE=30></p>
    <P><strong>Mensaje:</strong><br>
    <TEXTAREA NAME="message" COLS=30 ROWS=5 WRAP=virtual></TEXTAREA></p>
    <P><INPUT TYPE="submit" NAME="submit" VALUE="Send This Form"></p>
    </FORM>
    </BODY>
    </HTML>

    This is the receiving php page:

    <?php
    $msg = "ESTOS SON LOS DATOS RECIBIDOS:\n";
    $msg .= "Nombre: $_post['sender_name'])\n";
    $msg .= "E-Mail: $_post['sender_email']\n";
    $msg .= "Mensaje: $_post['message']\n\n";
    $to = "maulikan@agmr.x10.bz";
    $subject = "Send test";
    $mailheaders = "From: Alberto Marambio <> \n";
    $mailheaders .= "Reply-To: $sender_email\n\n";
    mail($to, $subject, $msg, $mailheaders);
    ?>

    The e-mail is sent, but don't display the data variables.
    Also I tried using get method, using " instead ' and specify variable name alone, for example:
    $msg .= "Nombre: $sender_name\n";
    none of them is working
    I'm not specifying charset

    regards.

  8. #8
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: POST & GET methods did'nt work

    Please use the [code] tag to display code. Thanks.

    Use $_POST, not $_post

    Also, your HTML is incorrect. You should be using lower case tags, and you need a doctype and opening HTML tag.

    ~Callum
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

  9. #9
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: POST & GET methods did'nt work

    Quote Originally Posted by Alex Mac View Post
    Please use the [code] tag to display code.
    Or [html] or [php], as appropriate.

    Note that, when properly indented, you can see structural problems with your code.
    HTML Code:
    <BODY>
      <FORM METHOD="post" ACTION="send_simpleform.php">
        <P><strong>Su Nombre:</strong><br>
            <INPUT type="text" NAME="sender_name" SIZE=30></p>
            <P><strong>Su E-Mail Address:</strong><br>
                <INPUT type="text" NAME="sender_email" SIZE=30></p>
                <P><strong>Mensaje:</strong><br>
                    <TEXTAREA NAME="message" COLS=30 ROWS=5 WRAP=virtual></TEXTAREA></p>
                <P><INPUT TYPE="submit" NAME="submit" VALUE="Send This Form"></p>
                </FORM>
                </BODY>
              </HTML>
    The unclosed <input>s and use of the non-semantic <br/> should be fixed. <strong> is also misused; it's supposed to denote strong emphasis, not simply a replacement for <b>. You should be using <label> to markup input labels. If you want them to be bold, use styling.

    HTML Code:
    <html>
      <head>
        <style type="text/css">
          label { 
            font-weight: bold; 
            display: block;
          }
          input[type='submit'] {
            display: block;
          }
          input[type='text'],
          input:not([type='submit']),
          textarea#message
          {
              width: 30em;
          }
          textarea#message {
            height: 6em;
          }
        </style>
      </head>
      <body>
        <form method="POST" action="send_simpleform.php">
          <label for="sender_name">Su Nombre:</label>
          <input id="sender_name" name="sender_name" />
          <label for="sender_email">Su E-Mail Address:</label>
          <input id="sender_email" name="sender_email" />
          <label for="message">Mensaje:</label>
          <textarea id="message" name="message" wrap="virtual"></textarea>
          <input type="submit" name="submit" value="send this form" />
        </form>
      </body>
    </html>
    PHP Code:
    <?php
    $msg 
    "ESTOS SON LOS DATOS RECIBIDOS:\n";
    $msg .= "Nombre: $_post['sender_name'])\n";
    Unlike function and class names, variable names are case sensitive. $_post is a different variable from $_POST.

    With heredocs, you can readily create multiline strings (though it should be noted that quoted strings can also span multiple lines).

    PHP Code:
    <?php
    if ("\n" == "\x0D\x0A") {
        
    $eol '';
    } else {
        
    $eol "\r";
    }
    $to "maulikan@agmr.x10.bz";
    $subject "Send test";
    $mailheaders =<<<EOS
    From: Alberto Marambio <> $eol
    Reply-To: 
    $sender_email$eol
    $eol
    EOS;
    $msg =<<<EOS
    ESTOS SON LOS DATOS RECIBIDOS:$eol
    Nombre: 
    $_POST[sender_name]$eol
    E-Mail: 
    $_POST[sender_email]$eol
    Mensaje: 
    $_POST[message]$eol
    $eol
    EOS;
    if (
    mail($to$subject$msg$mailheaders)):
        
    // very basic error handling. More should be done.
        
    ?>
        <p class="error">Message sent.</p>
    <?php else: ?>
        <p class="error">I couldn't send your message. Please try again later.</p>
    <?php endif; ?>
    Last edited by misson; 01-17-2011 at 11:36 AM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  10. #10
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: POST & GET methods did'nt work

    PHP Code:
    <?php
    if ("\n" == "\x0D\x0A") {
        
    $eol '';
    } else {
        
    $eol "\r";
    }
    Isn't that just
    PHP Code:
    $eol PHP_EOL
    ?

    ~Callum
    Last edited by callumacrae; 01-17-2011 at 12:44 PM.
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. How Did I Get Suspended I Did'nt Do Anything :(
    By arcade12 in forum Free Hosting
    Replies: 16
    Last Post: 12-10-2010, 12:16 PM
  2. Payment methods
    By macnkenzi in forum Free Hosting
    Replies: 1
    Last Post: 05-21-2010, 05:47 AM
  3. [Help]I did'nt know
    By Dj-adio in forum Free Hosting
    Replies: 2
    Last Post: 12-12-2007, 03:13 PM
  4. Why Me Site Is Down (did'nt Work)
    By Mi87IKR in forum Free Hosting
    Replies: 2
    Last Post: 11-18-2006, 03:44 AM
  5. post nuke doesnt work...
    By masterchief3k in forum Free Hosting
    Replies: 7
    Last Post: 07-28-2005, 08:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers