Jump to content

[SOLVED] Form Data not Submitting as either Get ot Post


audiokiwi

Recommended Posts

I have a form at the page http://audiokiwi.com/insertAlbum.php. No matter if the form is set to GET or POST, neither gets submitted (Under Firefox, IE, or Opera).

 

Here is the output of LiveHTTPHeaders for POST:

Sent:

POST /insertAlbum.php HTTP/1.1

Host: audiokiwi.com

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.4) Gecko/20070529 SUSE/2.0.0.4-8.1 Firefox/2.0.0.4

Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

Referer: http://audiokiwi.com/insertAlbum.php

Content-Type: application/x-www-form-urlencoded

Content-Length: 0

 

Recieved

HTTP/1.x 200 OK

Date: Wed, 20 Jun 2007 21:26:40 GMT

Server: Apache/2.2.3 (Linux/SUSE)

X-Powered-By: PHP/5.2.0

Content-Length: 2838

Keep-Alive: timeout=15, max=99

Connection: Keep-Alive

Content-Type: text/html; charset=iso-8859-1

 

The values of $_REQUEST $_POST and $_GET are all empty arrays.

 

Does anyone know what's going on?

Link to comment
Share on other sites

<?php 
include "connect.php";
    if($_REQUEST['submit']){
        if(trim($_REQUEST['name'])){
            $name = $_REQUEST['name'];
        }
        else {
            $error[] = 'Please enter an Album Name';
        }
        $artist = $_REQUEST['artist'];
        $genre = $_REQUEST['genre'];
        $rating = $_REQUEST['rating'];
        if(trim($_REQUEST['songs'])){
            $name = $_REQUEST['songs'];
        }
        else {
            $error[] = 'Please enter at least one song';
        }
        $songs = explode("\n",$_REQUEST['songs']);
        $serial = serialize($songs);
    }
    if(!$_REQUEST['sumbit'] || $error){
        if ($error){foreach ($error as $c){
        $str.= "<div style='background:#FF9999;padding:2px;margin:2px;'>$c</div>\n";
        }}
        $str .= "<form action='insertAlbum.php' method='post'><p>Album Artist: \n";
        $str .= "<select id='artist'>\n";
        $str .= "<option value='0'>Various Artists</option>\n";
        $result = $dbr->query("SELECT * FROM music_artists");
        while($row = $result->fetch_assoc())
        {
            $str .= "<option value='{$row['id']}'>{$row['name']}</option>\n";
        }
        $str .="</select>\n";
        $str .= "<br />Album Name: <input id='name' type='text' /><br />\n";
        $str .= "Genre: <select id='genre'\n>";
        $str .= "<option value='0'>None</option>\n";
        $result = $dbr->query("SELECT * FROM music_genres");
        while($row = $result->fetch_assoc())
        {
            $str .= "<option value='{$row['id']}'>{$row['name']}</option>\n";
        }
        $str .= "</select>";
        $str .= "<br />Rating: <select id='rating'>\n<option value='0.5'>0.5</option>\n<option value='1.0'>1.0</option>\n<option value='1.5'>1.5</option>\n<option value='2.0'>2.0</option>\n<option value='2.5'>2.5</option\n><option value='3.0'>3.0</option>\n<option value='3.5'>3.5</option>\n<option value='4.0'>4.0</option>\n<option value='4.5'>4.5</option>\n<option value='5.0'>5.0</option>\n</select><br />\nSong Names (One Name Per Line):<br />\n<textarea cols='40' rows='20' id='songs'></textarea><br />\n<input type='submit' id='submit' value='Submit' />\n";
        $str .= '</p></form>';
    }

include "user.php";
include "template.php";
$section="main";
$page= new Template("Music",TRUE);
$page->pr_logo();
$page->pr_leftnav();
$page->pr_content(FALSE);
$page->pr_entry("Add an Album",$str);
$page->pr_content(TRUE);
$page->pr_footer();
?>

template.php:

<?php
class Template{
    public $xmlhtmlmode='text';
    function __construct($title,$validate = TRUE,$skipa=FALSE)
    {
        $doctype = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">';
        $scs = "lang='eng' ";
        if($validate){   
            if (stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") || stristr($_SERVER['HTTP_USER_AGENT'],"W3C") ){
                //header("Content-type: application/xhtml+xml");
                $doctype = "\n" . '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">';
                $scs = "";
                $this->xmlhtmlmode = 'app';
            }
        }
        if (!$skipa)$title .= " | Audio Kiwi: Music and You";
        echo "$doctype\n<html xmlns='http://www.w3.org/1999/xhtml' {$scs}xml:lang='eng'>\n    <head>\n        <link rel='stylesheet' href='/style.css' />\n        <link rel='openid.server' href='http://www.myopenid.com/server' />\n        <link rel='openid.delegate' href='http://audiokiwi.myopenid.com' />\n        <title>$title</title>\n    </head>\n";
    }
    function pr_logo()
    {
        echo "    <body>\n        <div id='container'>\n            <div id='top'>\n                <img src='/images/logo.png' id='logo' alt='AudioKiwi | Music and You' />\n            </div>";
    }
    function pr_leftnav($sectionc=FALSE)
    {
        if (!$sectionc) global $section;
        else $section=$sectionc;
        echo "            <div id='bbg'>\n                <div id='leftnav'>\n                    <h2>Audio Kiwi</h2>\n                    <ul>\n";
        if ($section!="main") echo "                        <li><a href='/'>Home</a></li>\n";
        else echo "                     <li><span class='currse'>Home</span></li>\n";
        if ($section!="music") echo "                     <li><a href='/music'>Music</a></li>\n";
        else echo "                     <li><span class='currse'>Music</span></li>\n";
        if ($section!="blog") echo "                     <li><a href='/blog'>My Ramblings</a></li>\n";
        else echo "                     <li><span class='currse'>My Ramblings</span></li>\n";
                    echo "                  </ul>\n                    \n                </div>";    
    }
    function pr_content($end,$older=NULL,$newer=NULL)
    {
        if (!$end) echo "\n                <div id='content'>";
        else {      echo "                      <p class='pagenav'>";
        if ($older) {echo "<a href='$older'>Older entries</a>";}
        else {echo "Older Entries";}
        echo " | "; 
        if ($newer) {echo "<a href='$newer'>Newer entries</a>";}
        else {echo "Newer Entries";}
        echo "</p>\n                 </div>";}
    }
    function pr_entry($heading,$contents,$url="")
    {
        echo "\n                  <div class='entry'>\n                      <h2><a href='$url'>$heading</a></h2>\n$contents\n                  </div>";
    }
    function pr_footer(){
        echo "<div id='footer'>
<h2 class='hide'>Site info</h2>
<span>Audio Kiwi</span><br/>
© ", @date("Y"), " Micah Makaiwi | Design by <a href='http://andreasviklund.com'>Andreas Viklund</a> | Valid: <a href='http://validator.w3.org/check?uri=referer'>XHTML 1.1</a> / <a href='http://jigsaw.w3.org/css-validator/check/referer'>CSS</a> / <a href='http://checker.atrc.utoronto.ca/servlet/Checkacc?file=http%3A%2F%2Faudiokiwi.blogdns.com",$_SERVER['REQUEST_URI'] ,"'>WCAG 2</a> / AA / 508
</div>
</div>
</div>

</body>
</html>";
    }
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.