Forum Moderators: coopster
The data from the form is sent to the second page via the POST method.
If I try to access the $_POST array contents, it's completely empty (var_dump($_POST) returns array(0) { } ).
If I change the method to GET on the first page, change var_dump($_POST) to var_dump($_GET) on the second page, the form is submitted correctly
My HTML is 100% validated by W3C validator and ini_set('error_reporting', E_ALL) returns 0 errors, none whatsoever
These 2 pages should just work together, but somehow the data is not submitted or whatever
HOW IS THIS POSSIBLE?
I really am baffled :(
eelix
eelix
am I wrong when I say that shouldnt really matter at all?
Yes. That directive [php.net] is of type
PHP_INI_ALLin PHP <= 5.0.5. After that it is of type
PHP_INI_PERDIR. It could very well be overridden in either version installation. The easiest way to find out is to dump the directive value to see if it is set that way in your form processing script. Seems as though as it would be unlikely, but never assume. ini_get() [php.net] will let you know either way.
eelix
I'll post some code later on :)
Maybe later one is now? I'm not seeing any logic to this. The only thing, I think, that may be causing it is something that you aren't seeing in your script. I'll keep searching for other possible problems though.
eelix
the code of the first page, domain obscured, db and session variable names obscured but rest is 1 on 1 the same
<?
ini_set("session.cookie_domain"," .site.com");
session_start();
if (!empty($_SESSION['username'])){ //if user is logged in.....
@mysql_select_db('db'); //...check what their details are so we can echo it to the browser
$nr_dvd_sell_query = 'SELECT COUNT(*) AS count FROM selllist'." WHERE uid='".$_SESSION['uid']."'";
$nr_dvd_sell_result = mysql_query($nr_dvd_sell_query) or die ("Error in query: $nr_dvd_sell_query " . mysql_error());
$nr_dvds_sell = mysql_fetch_array($nr_dvd_sell_result);
$nr_sell = $nr_dvds_sell['count'];?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>site.com - Your DVD sell list</title>
<? include ('meta_overall.php');?>
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
function un_check(){
for (var i = 0; i < document.sell_list.elements.length; i++) {
var e = document.sell_list.elements[i];
if ((e.name!= 'check_all') && (e.type == 'checkbox')) {
e.checked = document.sell_list.check_all.checked;
}
}
}
</SCRIPT>
<link href="http://www.site.com/main.css';}?>" rel="stylesheet" type="text/css">
</head>
<body>
<div align="center">
<? include ('header.php');?>
<? include ('menu.php');?>
<table width="90%" class="backgroundtable">
<tr>
<td width="18%" valign="top">
<? include ('leftcolumn.php');?>
</td>
<td width="82%" colspan="4" valign="top">
<div align="center">
<form name="sell_list" method="post" action="http://profile.site.com/edit/sell">
<table width="100%" border="0" class="innertableright" id="right">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" class="indexheadinfo"><div align="left"><strong>DVD's you want to sell</strong> (<? echo $nr_dvds_sell['count'];?>)</div></td>
</tr>
<tr>
<td valign="top" class="col2">
<? if ($nr_sell == 0){?>
<div align="center">No entries exist in this list yet</div>
<? exit;
}else{
$max_rows = 50; //set the maximum amount of rows
$current_row= ($count + 1); //set current row to '1' or $from would be negative on the next line ((0 * 5) - 5)
$from = (($current_row * $max_rows) - $max_rows); //calculate which results to query based on the row being displayed and the max results per row
$query= 'SELECT * FROM user_selllist'." WHERE uid='".$_SESSION['uid']."' ORDER BY mid ASC LIMIT $from, $max_rows";
$result = mysql_query($query) or die ("Error in query: $query " . mysql_error());
$nr_dvds_this_row = mysql_num_rows($result); //count the number of results for each row because if it doesnt fill the row we need to draw empty cells
$nr_empty_tds =($max_results_per_row - $nr_dvds_this_row); //calculate the actual number of empty cells?>
<!-- BEGIN DYNAMIC CONTENT -->
<div align="center">
<table width="100%" border="0" class="backgroundtable">
<tr>
<td class="col2"> </td>
<td class="col2"> </td>
<td class="col2"> </td>
<td class="col2"> </td>
<td colspan="6" class="dvd_have_list_cell"><div align="center">Shipping & handling </div></td>
<td class="col2"> </td>
<td class="col2"> </td>
</tr>
<tr>
<td colspan="13" class="rowdivide"><img src="http://www.site.com/spacer.gif" width="1" height="1" ALT="spacer_img"></td>
</tr>
<tr>
<td width="3%" class="col2"><div align="center"><input name="check_all" type="checkbox" value="" title="select/ deselect all" onClick="un_check();"></div></td>
<td width="7%" class="col2"> </td>
<td width="10%" class="col2"><div align="center"><strong>Price</strong></div></td>
<td width="15%" class="col2"><div align="center"><strong>sell type</strong></div></td>
<td width="10%" class="col2"><div align="center"><strong>R1</strong></div></td>
<td width="10%" class="col2"><div align="center"><strong>R2</strong></div></td>
<td width="10%" class="col2"><div align="center"><strong>R3</strong></div></td>
<td width="10%" class="col2"><div align="center"><strong>R4</strong></div></td>
<td width="10%" class="col2"><div align="center"><strong>R5</strong></div></td>
<td width="10%" class="col2"><div align="center"><strong>R6</strong></div></td>
<td width="10%" class="col2"><div align="center"><strong>Quantity</strong></div></td>
<td width="5%" class="col2"><div align="center"><strong>Currency</strong></div></td>
</tr>
<? for ($count=0; $row = mysql_fetch_array($result); $count++){//draw the cells with dvd cover art via a function?>
<tr>
<td valign="middle" class="col2"><div align="center">
<input name="selected_dvd[]" type="checkbox" value="<? echo $row['id'];?>" class="checkbox"></div></td>
<td valign="middle" class="col2"><div align="center"><? func_makethumb_dvdcover_list_zoom($row['mid'], $row['sid']);?></div></td>
<td class="col2"><div align="center"><? echo $row['price'];?> <? echo $row['currency'];?></div></td>
<td class="col2"><div align="center"><? echo $row['sell_type'];?></div></td>
<td class="col2"><div align="center"><? echo $row['sh_r1'];?></div></td>
<td class="col2"><div align="center"><? echo $row['sh_r2'];?></div></td>
<td class="col2"><div align="center"><? echo $row['sh_r3'];?></div></td>
<td class="col2"><div align="center"><? echo $row['sh_r4'];?></div></td>
<td class="col2"><div align="center"><? echo $row['sh_r5'];?></div></td>
<td class="col2"><div align="center"><? echo $row['sh_r6'];?></div></td>
<td class="col2"><div align="center"><? echo $row['quantity'];?></div></td>
<td class="col2"><div align="center"><? echo $row['currency'];?></div></td>
</tr>
<? }?>
<tr>
<td colspan="12" valign="middle" class="indexheadinfo"><div align="left"> <img src="http://www.site.com/images/icons/html_checkbox2.gif" alt="icon" width="16" height="22" class="img_bottom">
<select name="mode" class="menu" onChange="this.form.submit();">
<option value="" selected>select</option>
<option value="sell_to_sell">move to selllist</option>
<option value="sell_to_have">copy to have list</option>
<option value="sell_edit">edit</option>
<option value="sell_delete">delete</option>
</select>
<noscript><input type="submit" name="submit" value="go" class="postbuttons_bold"></noscript></div></td>
</tr>
</table>
</div>
<? }?>
<!-- END DYNAMIC CONTENT -->
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</div>
</td>
</tr>
</table>
<br/>
<? include ('copy.php');?>
</div>
</body>
</html>
<? }
<?
ini_set("session.cookie_domain"," .site.com");
ini_set('error_reporting', E_ALL);
session_start();
var_dump($_POST);
echo ini_get('variables_order');
if (!empty($_SESSION['username']) && (!empty($_POST['mode']) && $_POST['mode'] === 'sell_edit')){ //if user is logged in.....?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Site.com - Set prices for the DVDs</title>
<? include ('meta_overall.php');?>
<link href="http://www.site.com/main.css" rel="stylesheet" type="text/css">
</head>
<body>
<div align="center">
<? include ('header.php');?>
<? include ('menu.php');?>
<br/>
<form name="edit_selllist" method="POST" action="">
<table width="90%" border="0" class="innertableright" id="right">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" class="col2">
<div align="center">
<table width="100%" border="0" class="backgroundtable" cellpadding="0" cellspacing="0">
<tr>
<td width="30%" class="indexheadinfo"><div align="left"></div></td>
<td width="10%" class="indexheadinfo"><div align="center">sell type</div></td>
<td width="5%" class="indexheadinfo"><div align="center">price</div></td>
<td width="6%" class="indexheadinfo"><div align="center">region 1</div></td>
<td width="6%" class="indexheadinfo"><div align="center">region 2</div></td>
<td width="6%" class="indexheadinfo"><div align="center">region 3</div></td>
<td width="6%" class="indexheadinfo"><div align="center">region 4</div></td>
<td width="6%" class="indexheadinfo"><div align="center">region 5</div></td>
<td width="6%" class="indexheadinfo"><div align="center">region 6</div></td>
<td width="5%" class="indexheadinfo"><div align="center">quantity</div></td>
<td width="15%" class="indexheadinfo"><div align="center">currency</div></td>
</tr>
<?
$nr_dvds = count($_POST['selected_dvd']);
for ($count=0; $count<$nr_dvds; $count++){
$sid = mysql_real_escape_string($_POST['selected_dvd'][$count]);
$query = 'SELECT * FROM selllist'.
" INNER JOIN movies ON movies.mid=selllist.mid".
" INNER JOIN dvds on dvds.sid=selllist.sid".
" WHERE selllist.sid='$sid'";
$result = mysql_query($query) or die ("Error in query: $query ");
$row = mysql_fetch_array($result);?>
<tr>
<td class="colsmalltxt"><div align="left"><a href="http://db.cinemasiafreaks.com/view/?mid=<? echo $mid;?>&sid=<? echo $sid;?>">R<? echo $row['region'];?> - <? echo $row['colorsystem'];?> - <? echo $row['discs'];?> Disc - <? echo ucwords($row['country_edition']);?> version</a><input name="sid[]" type="hidden" value="<? echo $sid;?>"></div></td>
<td>
<div align="center">
<? func_sell_type_selector($mid, $sid, $_SESSION['uid']);?>
</div>
</td>
<td class="col2"><div align="center"><input name="price[]" type="text" size="3" maxlength="6" class="txtfield" value="<? echo $row['price'];?>"></div></td>
<td class="col2"><div align="center"><input name="sh_r1[]" type="text" size="3" maxlength="6" class="txtfield" value="<? echo $row['sh_r1'];?>"></div></td>
<td class="col2"><div align="center"><input name="sh_r2[]" type="text" size="3" maxlength="6" class="txtfield" value="<? echo $row['sh_r2'];?>"></div></td>
<td class="col2"><div align="center"><input name="sh_r3[]" type="text" size="3" maxlength="6" class="txtfield" value="<? echo $row['sh_r3'];?>"></div></td>
<td class="col2"><div align="center"><input name="sh_r4[]" type="text" size="3" maxlength="6" class="txtfield" value="<? echo $row['sh_r4'];?>"></div></td>
<td class="col2"><div align="center"><input name="sh_r5[]" type="text" size="3" maxlength="6" class="txtfield" value="<? echo $row['sh_r5'];?>"></div></td>
<td class="col2"><div align="center"><input name="sh_r6[]" type="text" size="3" maxlength="6" class="txtfield" value="<? echo $row['sh_r6'];?>"></div></td>
<td class="col2"><div align="center"><input name="quantity[]" type="text" size="3" maxlength="3" class="txtfield" value="<? echo $row['quantity'];?>"></div>
</td>
<td>
<div align="center">
<? func_currency_selector($row['currency']);?>
</div>
</td>
</tr>
<? }?>
<tr>
<td colspan="11" valign="middle" class="indexheadinfo">
<div align="center"><? if ($result){?><div align="center"><strong>Because one ore more of the selected items where already on your sell list, you can only edit those items, you can not add them seperately....</strong></div><? }?>
<input name="mid" type="hidden" value="<? echo $mid;?>">
<input name="dvd_mode" type="hidden" value="addselllist">
<input type="submit" name="submit" value="submit" class="postbuttons_bold">
</div>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<br/>
<br/>
<? include ('copy.php');?>
</div>
</body>
</html>
<? }
<form action="upload.asp" method="POST" enctype="multipart/form-data">
also, try accessing the $http_raw_post_data var to see if you get anything. If you do, it's probably an enctype problem, but you can get and parse the data yourself from there.
Thanks for the input though :)
Also, the $http_raw_post_data var....is this a pre-defined PHP variable? Cant find much about it, but it appears to be something from ZEND or summat...
First, try to use relative path to the actual filename:
<form name="sell_list" method="POST" action="/edit/sell.php">
I venture a guess that the method of resolving "http://profile.site.com/edit/sell" to the actual processing script involves some kind of redirect or rewrite that is dumping the postdata.
Next, remove everything (*Of course, back up everything, this is just for debugging.*) from the processing script, add this line and retest:
print_r(get_defined_vars());
I can't imagine what in your processing script could cause postdata to disappear, but best to reduce the test case down to as little script as possible that reproduces the error.
[edited by: whoisgregg - Tue, 16 May 2006 13:42:28 GMT]
Google Groups [groups.google.com]
Worth a shot.
dc