AndyB Posted September 3, 2006 Share Posted September 3, 2006 That's pretty much what I was afraid of ;DI'd change the FORM code so that instead of sending the item name, it sent the itemid[code]<input type="hidden" name="itemID" value="$itemID">[/code]Then I'd change the second page so it retrieved itemID and I'd use itemID in the query. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85199 Share on other sites More sharing options...
Pi_Mastuh Posted September 3, 2006 Author Share Posted September 3, 2006 Now it displays everything the name should be as the ID number. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85203 Share on other sites More sharing options...
AndyB Posted September 3, 2006 Share Posted September 3, 2006 You have the advantage over me here, because I can't see the first page code. The error you're seeing almost surely results from how ' and " are used in your code in the area around where the form is being output. If you post a few relevant lines, we can fix the error you're seeing. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85209 Share on other sites More sharing options...
Pi_Mastuh Posted September 3, 2006 Author Share Posted September 3, 2006 This is the entire first page:[code] <table width="484" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CC3300"> <tr> <td width="480" align="center" valign="top"> <table width="500" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#FF9900"> <div align="center"><font size="2" face="Arial, Helvetica, sans-serif"><strong>My Items </strong></font></div></td> </tr> <tr> <td> <table width=100% border="0" cellspacing="0"> <tr> <td><div align="center"></div></td> </tr> <tr> <? $query_myItems = "SELECT * FROM myitemschibi WHERE userID = '$preuserID' and itemQty > '0'";$result_myItems = mysql_query($query_myItems, $connection);$query_data = mysql_fetch_array($result_myItems);$numberItems = mysql_num_rows($result_myItems);$i = 0;if ($numberItems < 1) { print "<td><CENTER><P>You have no items.</CENTER>";}else { $rowcount = 0; while ($numberItems > $i) { if ($rowcount == 3) { echo "</tr>\n<tr>"; $rowcount = 0; } //$monopetImage1 = mysql_result($result2,$i,"monopetImage1"); $itemName = mysql_result($result_myItems,$i,"itemName"); //$itemDesc = mysql_result($result_myItems,$i,"itemDesc"); $itemQty = mysql_result($result_myItems,$i,"itemQty"); $petPointsValue = mysql_result($result_myItems,$i,"petPointsValue"); //$itemSpecial1 = mysql_result($result_myItems,$i, "itemSpecial1"); //$itemSpecial2 = mysql_result($result_myItems,$i, "itemSpecial2"); //$isequippable = mysql_result($result_myItems,$i, "isequippable"); //$itemNumUses = mysql_result($result_myItems,$i, "itemNumUses"); //$itemAttackValue = mysql_result($result_myItems,$i, "itemAttackValue"); $itemID = mysql_result($result_myItems,$i, "itemID"); $image = str_replace(" ", "", $itemName); $spacedname = str_replace(" ", "%20", $itemName); print '<td width=150 height=150> <center><font face=Arial, Helvetica, sans-serif size=2>'; // only display image if image exists (no broken images) if(file_exists('../images/items/'.$image.'.jpg')) { echo '<img src=../images/items/'.$image.'.jpg>'; } else { echo '<br><br><b>No Image<br>Available<br></b>'; } print"<br><form action=../reg/secure/itemdetails.php method=post><input type=hidden name='itemID' value=$itemID><input type=image src=../images/details.jpg></FORM><br> "; if($isequippable == '1') { echo '<br><i><B>Equippable</b>'; if($itemAttackValue > 0) { echo '<br>'.$itemAttackValue.' Attack Power'; } else { echo '<br>'.abs($itemAttackValue).' Healing Power'; } echo '<br>'.ucwords($itemNumUses).' Uses Remaining'; } echo '</font></td>'; $i++; $rowcount++; }}///////?> </tr> </table> </tr> </table> <div align="center"></div></td> </tr> </table> [/code] Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85213 Share on other sites More sharing options...
AndyB Posted September 3, 2006 Share Posted September 3, 2006 OK, there's a hidden input field that contains the value of itemID so change the second page to retrieve it as I suggested.[code]<?php$itemID = $_POST['itemID'];include ("secure/config3.php");$SQL = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";[/code]Give it try and report back on the outcome. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85252 Share on other sites More sharing options...
Pi_Mastuh Posted September 3, 2006 Author Share Posted September 3, 2006 Ok. It worked I guess but theres another problem.Now It's not fetching the info again. Wen I look at the URL of the picture it says http://www.net-petz.com/reg/images/items/.jpg Here's how i have it coded:<img src="../images/items/<?echo$image;?>.jpg">Here's some other snippets of code that relate: $image = str_replace(" ", "", $itemName); $spacedname = str_replace(" ", "%20", $itemName);Which I have under $itemID = $_POST['itemID'];include ("secure/config3.php");$SQL = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'"; Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85364 Share on other sites More sharing options...
AndyB Posted September 3, 2006 Share Posted September 3, 2006 <img src="../images/items/<?echo$image;?>.jpg">Try [code]<img src="../images/items/<?php echo $image;?>.jpg">[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85408 Share on other sites More sharing options...
Pi_Mastuh Posted September 3, 2006 Author Share Posted September 3, 2006 Nope :-\. I think the problem is that none of the data is reaching the page for some reason. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85411 Share on other sites More sharing options...
AndyB Posted September 4, 2006 Share Posted September 4, 2006 On your first page, you have this code:[code]<form action=../reg/secure/itemdetails.php method=post><input type=hidden name='itemID' value=$itemID>[/code]Take a look at the generated html code and post here exactly what you see when you view the html source code.That form will send the value of itemID to the itemdetails.php page where this line retrieves it. [code]$itemID = $_POST['itemID']; // retrieve itemID from form data[/code][quote]I think the problem is that none of the data is reaching the page for some reason.[/quote]Can you provide a more explicit description of the problem than that. Why do you think so? What happens, doesn't happen, etc. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85691 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 All the HTML code is in the page I posted before, except the actual htm page which is only <? include ("secure/config.php"); include ("secure/itemdetails.php"); ?>I think it's not reaching it because it's simply a blank table, and again the image is showing up as /items/.jpg. If the data were reaching it the name would show up and the imge would show up as $itemname.jpg. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85732 Share on other sites More sharing options...
AndyB Posted September 4, 2006 Share Posted September 4, 2006 Sorry, let me explain. I/we don't want to see the [b]code[/b] from the first page, I/we want to see what the browser generates based on that code (view source of the generated page). Then it will be obvious exactly what values have been placed in the form code, e.g. it will say name="itemID" value="12" or something like that. If the value is blank then the problems in the first page. If the value is a good one, then the reason why the second page doesn't work will lie in the code for the second page (and I think there's no problem there). The second page snippet you just posted clearly shows that whatever value should be there for the image name isn't there so I'm thinking there's a problem with your first page and how it generates the form. If not, we can work on fixing whatever isn't happening on the second page. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85745 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 it's not letting me post it >:( Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85792 Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 Paste your code over at pastebin.com, your code most probably has something in it which is tripping the IPS we have installed here. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85797 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 It just comes up with a page cannot be displayed.If I give you the URL and an account to login to would you be able to look at it? Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85803 Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 Just post the code over at pastebin.com and provide a link to the posted code. That way we can see your code. Or a better option would be to attach the file to your post (Reply button > Additional Options... link > clik browse button to attach a file to the post.)You can probide a demo account yes, as that way we can see whats going on Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85810 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 My site's www.net-petz.com/home.htm then hit login and both the username and password are test. Then hit My Inventory. That's the first page. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85815 Share on other sites More sharing options...
AndyB Posted September 4, 2006 Share Posted September 4, 2006 [code]<form action=../reg/secure/itemdetails.php method=post><input type=hidden name='itemID' value=40><input type=image src=../images/details.jpg></FORM><br>[/code]That's the html code generated. Since it clearly contains a value for itemID, either there's something wrong with the reg/secure/itemdetails.php page or there's nothing in the database where itemID is 40.If you're certain that there is something in the database with itemID of 40 (don't assume, check it please), then there's a problem with the itemdetails.php script that's on your server right now. Make sure that the thing is always called itemID in queries and the database etc. since all this stuff is case-sensitive. Guess we need to see the complete code for mydetails.php exactly as it presently exists on your server if none of the above actually points you at the problem and solution. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85823 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 Yes, itemID 40 exists. Belongs to userID 29, itemName is spicy pepper pizza. here's the whole itemdetails.php code:[code]<?session_start();$session=session_id( );$itemID = $_POST['itemID'];include ("secure/config3.php");$SQL = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'"; $image = str_replace(" ", "", $itemName); $spacedname = str_replace(" ", "%20", $itemName);?><html><head><title><? print $itemName; ?></title></head><body><BR><table width="227" border="0" cellspacing="0" cellpadding="0" height="104" style="border-collapse: collapse" bordercolor="#111111"> <tr> <td height="104" valign="top" width="227" bordercolorlight="#000080"> <table width="200" border="1" cellspacing="0" cellpadding="0" bgcolor="#6699FF" bordercolor="#000066"> <tr> <td align=center> <table width="200" border="0" cellspacing="0" cellpadding="0"> <tr align=center bgcolor="blue"> <td align=center bgcolor="blue"> <div align="center"><font face=Arial, Helvetica, sans-serif size=3 color="blue"><b> <? print "$spacedname"; ?> </b></font></div> </td> </tr> <tr bgcolor="#FFFFFF" align="center"> <img src="../images/items/<?php echo $image;?>.jpg"> <br> </tr> </table> </td> </tr> </table><BR> <table width="205" border="1" cellspacing="0" cellpadding="0" bordercolor="#000099"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%"> <tr bgcolor="#FFCCFF"> <td height="20" colspan="2" bgcolor="#0000FF" bordercolor="navy"><div align="center"> <font face="Arial, Helvetica, sans-serif" size="2" color="#FFFFFF"><b>Item Info:</b></font></div></td> </tr> <tr> <td width="99" height="10" bordercolor="navy"><font face="Arial, Helvetica, sans-serif" size="1"> Type:</font></td> <td width="101" height="10" bordercolor="navy"><font face="Arial, Helvetica, sans-serif" size="1"><? print "$type"; ?></font></td> </tr> <tr> <td height="19" bordercolor="navy"><font face="Arial, Helvetica, sans-serif" size="1">Use:</font></td> <td height="19" bordercolor="navy"><font face="Arial, Helvetica, sans-serif" size="1"> </font> </tr> </table></td> </tr> </table><br> </td> </table> </html>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85827 Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 Well theres your problem. Your not running the query ($sql) at all. All you are doing is assign $sql the string "[i]SELECT * FROM myitemschibi WHERE itemID ='$itemID'[/i]" which wont do nothing. Or am I missing something here? Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85832 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 Ok. What should I put there? Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85834 Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 Add this:[code=php:0]$result = mysql_query($sql);$row = mysq_fetch_assoc($result);extract($row);[/code]After [code=php:0]$SQL = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85845 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 Still doesn't work... ??? Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85856 Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 Change this:[code]<?phpsession_start();$session=session_id( );$itemID = $_POST['itemID'];include ("secure/config3.php");$SQL = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";$result = mysql_query($sql);$row = mysql_fetch_assoc($result);extract($row); $image = str_replace(" ", "", $itemName); $spacedname = str_replace(" ", "%20", $itemName);?>[/code]To:[code]<?phpsession_start();$session = session_id();$itemID = $_POST['itemID'];include ("secure/config3.php");$SQL = "SELECT * FROM myitemschibi WHERE itemID ='$itemID'";$result = mysql_query($SQL);$row = mysql_fetch_assoc($result);echo '<pre>' . print_r($row, true) . '</pre>';die();$image = str_replace(" ", "", $itemName);$spacedname = str_replace(" ", "%20", $itemName);?>[/code]Post what it returns here. Dont panic if your page doesnt display correctly, I have made it do that. Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85868 Share on other sites More sharing options...
Pi_Mastuh Posted September 4, 2006 Author Share Posted September 4, 2006 Fatal error: Call to undefined function: mysq_fetch_assoc() in /homepages/20/d175171605/htdocs/reg/secure/itemdetails.php on line 12 Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85876 Share on other sites More sharing options...
wildteen88 Posted September 4, 2006 Share Posted September 4, 2006 OOps, forgot the L (lowercase). change [code=php:0]$row = mysq_fetch_assoc($result);[/code] to [code=php:0]$row = mysql_fetch_assoc($result);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/19493-how-do-i-send-data-from-1-page-to-another/page/2/#findComment-85878 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.