I’m using openSUSE 10.3 with apache 2 and php 5 from the main/update repos. A fairly standard configuration, with some caveats below.
I have a form (in xhtml 1.1) with method “post” action “process.php” and enctype “multipart/form-data” (although the type doesn’t seem to matter, I’ve tried others).
When accessed from process.php, loaded following form submission, $_POST is empty. Passing it to print_r results in only “Array ( )”.
I tried inserting into (and have since removed from) my server directory configuration:
<Limit POST>
order allow,deny
allow from all
</Limit>
Despite configuring the server to populate the html raw data or whatever it was, its related PHP variable was also empty. GET also doesn’t work. I think I tried a couple of other things, but I’m at a loss to remember what. All this is done on a single laptop, haven’t tried anything from a remote host.
Frankly, I am at a loss. I have little doubt that I am missing something obvious but, since I am missing it, I’m hoping someone here can illuminate the matter for me.
If you’re using Firefox perhaps install the HTTP Headers
extension/plug-in/add-on and make sure your browser is properly sending
all you think it should. To test GET you can append anything you want
to your URL and you should see that in $_GET if you look at it with PHP.
I assume you’ve verified PHP works at some level since you mentioned
making a form in static HTML as a test…
Good luck.
Solar Granulation wrote:
> I’m using openSUSE 10.3 with apache 2 and php 5 from the main/update
> repos. A fairly standard configuration, with some caveats below.
>
> I have a form (in xhtml 1.1) with method “post” action “process.php”
> and enctype “multipart/form-data” (although the type doesn’t seem to
> matter, I’ve tried others).
>
> When accessed from process.php, loaded following form submission,
> $_POST is empty. Passing it to print_r results in only “Array ( )”.
>
> Firebug shows this:
>> Content-Type: multipart/form-data;
>> boundary=---------------------------18241582601317123334195430822
>>
>> 4
>>
>> Content-Length: 63
>>
>> -----------------------------182415826013171233341954308224–
>
> My access log says this:
>> 127.0.0.1 - - [22/Aug/2008:20:59:27 +0100] “POST /GLUserFed/process.php
>> HTTP/1.1” 200 2366 “http://localhost/GLUserFed/articulate.php”
>> “Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.0) Gecko/2008061600
>> SUSE/3.0-1.1 Firefox/3.0”
>
> I tried inserting into (and have since removed from) my server
> directory configuration:
>
> Code:
> --------------------
> <Limit POST>
> order allow,deny
> allow from all
> </Limit>
> --------------------
>
>
> Despite configuring the server to populate the html raw data or
> whatever it was, its related PHP variable was also empty. GET also
> doesn’t work. I think I tried a couple of other things, but I’m at a
> loss to remember what. All this is done on a single laptop, haven’t
> tried anything from a remote host.
>
> Frankly, I am at a loss. I have little doubt that I am missing
> something -obvious- but, since I am missing it, I’m hoping someone here
> can illuminate the matter for me.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
Also, I failed to notice before (goodness knows how) that if using get… nothing is appended to the URL. Same goes for the other browsers I have installed. I’m… confused.
I almost forgot to say that, yes, PHP (apart from in this instance) is working very nicely.
That’s something I’m finding very odd. Obviously I have no trouble submitting form data to this forum, or other forums etc. But when I try to submit my own form to my own server on my own laptop… nothing.
First suspicion… a problem with the HTML. Care to paste the entire
form you’re using?
Good luck.
Solar Granulation wrote:
> That’s something I’m finding very odd. Obviously I have no trouble
> submitting form data to this forum, or other forums etc. But when I try
> to submit my own form to my own server on my own laptop… nothing.
>
> Why, why would that be?
>
> I feel like I’m head butting a wall.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
This is the non-plain html version. I thought, since this is the important one, it only made sense. I considered leaving out unrelated bits, but then I thought I might as well post the lot… so here it comes!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/2001/REC-xhtml11-20010531/DTD/xhtml11-flat.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB">
<head>
<title>GNU/Linux User Federation - Submit Article</title>
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="author" content="Matthew Ayres solar.granulation@gmail.com" />
<meta name="description" content="The GNU/Linux User Federation - A project to unite the communities." />
<meta name="keywords" content="GNU/Linux, Linux, GLUF, distro, unity, harmony, user community, Linux users" />
<link rel="stylesheet" type="text/css" href="./gluf.css" />
<script type="text/javascript" src="./targetExternals.js"></script>
<!--[if IE]>
<meta http-equiv="refresh" content="0;URL=./notforie.html">
<![endif] -->
<link rel="stylesheet" type="text/css" href="./SolarsPopup.css" />
<script type="text/javascript" src="./SolarsPopup.js"></script>
<script type="text/javascript" src="./richSelections.js"></script>
<script type="text/javascript">
var richText = "articleContent";
</script>
</head>
<body>
<div><img src="./images/trcorner.png" style="margin: 0; vertical-align: top; float: right;" width="20" height="20" alt="" /><!-- The top right corner --></div>
<div id="header"><img src="./images/tlcorner.png" style="margin: 0; vertical-align: top;" width="20" height="20" alt="" />
<a rel="internal" href="./"><img src="./images/logo.png" id="logo" height="150" width="150" alt="The GNU/Linux User Federation" /></a>
<p id="quote">“I could have made money this way, and perhaps amused myself writing code. But I knew that at the end of my career, I would look back on years of building walls to divide people, and feel I had spent my life making the world a worse place.” — Richard M. Stallman</p>
<div id="menubar">
<ul>
<li><a rel="internal" href="./">Home</a></li>
<li class="bl"><a rel="internal" href="./membership.html">Membership and Participation</a></li>
<li class="bl"><a rel="internal" href="./articles.php">Member articles</a></li>
<li class="bl"><a rel="internal" href="./common.html">Common ground</a></li>
<li class="bl"><a rel="internal" href="./features.html">Feature origins</a></li>
<li class="bl"><a rel="internal" href="./abtgluf.html">About GLÜF</a></li>
<li class="bl"><a rel="internal" href="http://forum.gluf.org.uk/" title="GLÜF Forum">GLUFF</a></li>
</ul>
</div>
</div>
**<form id="articulate" action="./process.php" method="post" enctype="multipart/form-data">**
<div id="content" style="z-index: 1;">
<h1>Submit Article</h1>
**<fieldset style="border: 0;">**
<p>Please be aware that your article will not immediately appear on the Member Articles page. As part of our anti-spam and anti-abuse procedures we manually review every submission for approval.</p>
<div style="margin-left: 4%; width: 95.7%; font-size: 0.8em;">
**<input id="articleTitle" type="text" class="text" title="Title" />**<br />
<div id="rich" style="margin: 0; padding: 0;">
**<input onclick="imagePop(richText);" type="button" value="Insert image" /><input onclick="linkPop(richText);" type="button" value="Insert hyperlink" />
<input onclick="wrapSelection(richText,'**','**');" type="button" value="Bold" /><input onclick="wrapSelection(richText,'*','*');" type="button" value="Italic" /><input onclick="wrapSelection(richText,'','');" type="button" value="Underline" />
<input onclick="wrapSelection(richText,'[h]','[/h]');" type="button" value="Section heading" /><input onclick="wrapSelection(richText,'[sh]','[/sh]');" type="button" value="Subsection heading" />
<textarea id="articleContent" rows="20" cols="100" style="height: 20em;" title="Content"></textarea>**
<table style="width: 100%">
<tr>
<td style="width: 10%; text-align: right;">Screen alias:</td>
<td style="width: 34%;">**<input type="text" class="text" id="alias" />**</td>
<td style="width: 7%; text-align: right;">e-mail:</td>
<td style="width: 34%;">**<input type="text" class="text" id="email" />**</td>
<td style="width: 12%; text-align: right;">Publish e-mail:</td>
<td style="width: 3%;">**<input type="checkbox" id="use" />**</td>
</tr>
</table>
</div>
**<input type="submit" value="Submit" style="font-size:2em;" />**
</div>
**</fieldset>**
</div>
**</form>**
<!-- Solar's Popup form! -->
<form id="popForm" action="javascript:unPop();">
<div id="popup">
<h2 id="popHead"></h2>
<div id="popBod">
<p id="popText"></p>
<fieldset id="popCtrls"></fieldset>
</div><!-- popBod -->
</div><!-- popup -->
</form><!-- popForm -->
<!-- End of Solar's Popup form -->
</body>
</html>
Your form is faulty. You made two classes of mistake. In some places you use id=‘something’ to label your input widgets. In fact you should use name=‘something’. id and name are not the same thing. In others you don’t provide a name=. Change the textarea from id=‘articleContent’ to name=‘articleContent’ and you will see something come through.
Could’ve done that, aye, but I didn’t like the idea of bloating the code that way. Instead I used getElementsByName()[0] because, having unique names as they do, they’re always the first item in an array returned by that function.
This is what I do in all my HTML… both name and ID… haven’t had a
problem yet, and in my comparisons it increased the size of overall
pages by, on a tiny page, 1% (to me, very negligible).
Good luck.
ken yap wrote:
> Presumably you need both id= and name= when the input widget is also
> referred to from JS using getelementbyid.
>
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org