Results 1 to 7 of 7

Thread: [RESOLVED] $_POST is null?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    236

    Resolved [RESOLVED] $_POST is null?

    Hi,

    If i try to post a form (which is placed on two different pages with the same action-page), the strings return null in IE but not in Firefox.

    Do you know why?

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: $_POST is null?

    post your code

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    236

    Re: $_POST is null?

    Page a:
    HTML Code:
    <form name='form2' method='post' action='addlog.php'>
      <table width='100%' border='0' cellspacing='0' cellpadding='0'>
        <tr> 
          <td align='center' width='33%'>Dato</td>
          <td width='33%' align='center'>Aktivitet</td>
          <td width='33%' align='center'>Varighed (timer)</td>
        </tr>
        <tr> 
          <td align='center'><input name='dato' type='textfield' size='22' value='<?php echo "".$date_array['mday']."/".$date_array['mon']."-".$date_array['year'].""; ?>'></td>
          <td width='33%' align='center'><input name='aktivitet' type='textfield' size='22'></td>
          <td width='33%' align='center'><input name='varighed' type='textfield' size='22'></td>
        </tr>
        <tr> 
          <td colspan='3' align='right'><input type='submit' name='Submit2' value='Tilf&oslash;j'></td>
        </tr>
      </table>
      <p align='right'>&nbsp; </p>
    </form>
    Page b:
    HTML Code:
    <form name='form2' method='post' action='addlog.php'>
      <table width='100%' border='0' cellspacing='0' cellpadding='0'>
        <tr> 
          <td align='center' width='33%'>Dato</td>
          <td width='33%' align='center'>Aktivitet</td>
          <td width='33%' align='center'>Varighed (timer)</td>
        </tr>
        <tr> 
          <td align='center'><input name='dato' type='text' size='22' value='<?php echo "".$date_array['mday']."/".$date_array['mon']."-".$date_array['year'].""; ?>'></td>
          <td width='33%' align='center'><input name='aktivitet' type='text' size='22'></td>
          <td width='33%' align='center'><input name='varighed' type='text' size='22'></td>
        </tr>
        <tr> 
          <td colspan='3' align='right'><input type='submit' name='Submit2' value='Tilf&oslash;j'></td>
        </tr>
      </table>
      <p align='right'>&nbsp; </p>
    </form>
    processing page:
    PHP Code:
    <?php
    include('isuser.php');
    include(
    'config.php');
    // connect to the mysql database server.
    mysql_connect ($dbhost$dbusername$dbuserpass);
    mysql_select_db($dbname) or die("Cannot select database");

    $tdato $_POST["dato"];
    $taktivitet $_POST["aktivitet"];
    $tvarighed $_POST["varighed"];
    $username $_SESSION["s_username"];

    if(!isset(
    $tdato)|!isset($taktivitet)|!isset($tvarighed)) {
    echo 
    "
    <script language='javascript' type='text/javascript'>
            alert('Du har ikke udfyldt alle felter!');
            top.location.replace('logbog.php');
    </script>
    <noscript>
    <META HTTP-EQUIV='REFRESH' CONTENT='0;logbog.php'>
    </noscript>"
    ;
    }else{
    $query="INSERT INTO $username (`dato` , `aktivitet` , `varighed` )
    VALUES ('
    $tdato', '$taktivitet', '$tvarighed')";
    mysql_query($query) or die(mysql_error());
    echo 
    "<META HTTP-EQUIV='REFRESH' CONTENT='0;logbog.php'>";
    }
    ?>

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: $_POST is null?

    type="textfield" doesn't exist. You need to use type="text"
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    236

    Re: $_POST is null?

    I have tried that

  6. #6
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: $_POST is null?

    You're all backwards. Use single quotes for strings in PHP and double quotes for attributes in HTML.

    And why do you give the form a name? (I honestly don't know what that does)

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    236

    Re: $_POST is null?

    Gee, penagate...didn't think that worked...
    It works like a charm right now - thanks!

Posting Permissions

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



Click Here to Expand Forum to Full Width