Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-29-2008, 07:36 PM
WebProWorld New Member
 

Join Date: Sep 2008
Posts: 18
ryanhouston RepRank 0
Lightbulb PHP PROBLEM: Cannot carry $_post through multiple pages.

hello i am currently coding a multi page contact form. I want all data from each page to be took through all the pages so at the end its just like one simple contact form but in different steps. This is the code i used to carry the $_POST inputs through each page to the final page:

Quote:
<?PHP
foreach ($_POST as $key => $val) {
echo "<input type='hidden' name='' . $key .
'' value='' . $val . '' />" . "\r\n";
}
?>
This code worked a charm up until i made my contact form use mysql database to display subjects and people you can contact i used the following code to display this data:

Quote:
<?php
$con = mysql_connect("localhost","my_user","my db password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("my_database", $con);



$result = mysql_query("SELECT * FROM db_table");


echo "<br /><table border='0' width='100%'>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td style='text-transform:capitalize;'><input name='toemail' type='radio' value='" . $row['feild'] . "' />" . $row['feild1] . "</td>";
echo "</tr>";
}
echo "</table><br />";
?>
After using this peice of php my code to carry the data through all the pages works up untill it gets to the page that you select who you would like to contact ( note: i used this same script on the index.php page of my script which is a page that displayed subjects from a mysql database and it carryied the data through pages perfect. ) Then when it gets to the sadmin.php page, it lets say stops working, It drops all data it carryied on and just keeps the email that its to send to so by the end of the pages the form only collected one peice of information the email address. Please look at my script and fix this problem so that from page index.php the data is carryied o to send_mail.php so that i can use the $_POST inputs in the email it sends me thanks for reading person who helps me will get the finished version free of charge once i have completed my project.


DOWLOAD THE SOURCE REQUIRED:
THANKS AGAIN
EMAIL ME: MRWHOUSTON1@AOL.COM

Last edited by ryanhouston : 09-29-2008 at 07:46 PM. Reason: giving source for greater understandment.
Reply With Quote
  #2 (permalink)  
Old 09-29-2008, 08:18 PM
DaveSawers's Avatar
WebProWorld Veteran
 

Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 389
DaveSawers RepRank 1
Default Re: PHP PROBLEM: Cannot carry $_post through multiple pages.

I can't see any reason why using MySQL should stop your hidden fields from working and passing on the data. I suspect the problem is elsewhere in that page (in a part you haven't included).

Use an HTML checker to make sure what you have coded is legitimate.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #3 (permalink)  
Old 09-29-2008, 08:22 PM
WebProWorld New Member
 

Join Date: Sep 2008
Posts: 18
ryanhouston RepRank 0
Default Re: PHP PROBLEM: Cannot carry $_post through multiple pages.

dave what is your email

and i will send you full source ( note: source is untidy and im finding new ways to make it easyier and neater )
Reply With Quote
  #4 (permalink)  
Old 09-29-2008, 08:23 PM
WebProWorld New Member
 

Join Date: Sep 2008
Posts: 18
ryanhouston RepRank 0
Lightbulb Re: PHP PROBLEM: Cannot carry $_post through multiple pages.

look at my script so far hello u will need to view source of each page to view the error
Reply With Quote
  #5 (permalink)  
Old 09-30-2008, 09:48 AM
DaveSawers's Avatar
WebProWorld Veteran
 

Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 389
DaveSawers RepRank 1
Default Re: PHP PROBLEM: Cannot carry $_post through multiple pages.

I'm not going to debug your source code for you. I don't mind helping with suggestions.

So clean up your code and the HTML it produces and perhaps the problem will just go away.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
  #6 (permalink)  
Old 09-30-2008, 11:09 AM
wige's Avatar
Moderator
WebProWorld Moderator
 

Join Date: Jun 2006
Location: United States
Posts: 1,843
wige RepRank 4wige RepRank 4wige RepRank 4wige RepRank 4
Default Re: PHP PROBLEM: Cannot carry $_post through multiple pages.

The way you are inserting the values into the hidden fields is sort of commenting them out. Basically, it looks like they are not being parsed correctly. You need to look at how you are generating the hidden fields and remove the extra characters from each field.
__________________
The best way to learn anything, is to question everything.
Reply With Quote
  #7 (permalink)  
Old 09-30-2008, 12:10 PM
WebProWorld New Member
 

Join Date: Sep 2008
Posts: 18
ryanhouston RepRank 0
Default Re: PHP PROBLEM: Cannot carry $_post through multiple pages.

thanks for your support guys this was really good help. Thanks again.
Reply With Quote
  #8 (permalink)  
Old 10-01-2008, 03:37 AM
edhan's Avatar
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Singapore
Posts: 581
edhan RepRank 1
Default Re: PHP PROBLEM: Cannot carry $_post through multiple pages.

Quote:
Originally Posted by ryanhouston View Post
look at my script so far hello u will need to view source of each page to view the error
I have gone through the script and it does not have any problem.
Reply With Quote
  #9 (permalink)  
Old 10-01-2008, 10:29 AM
WebProWorld Pro
 

Join Date: Aug 2007
Location: Southern Illinois USA
Posts: 154
kruser RepRank 0
Default Re: PHP PROBLEM: Cannot carry $_post through multiple pages.

Hello,

When I am looking for the value in an array using PHP I usually get it by:
Code:
$row[field]
Try this line and check the output on your system:

Code:
<?
  print"quoted array=$row['field]<br/>non quoted array = $row[field]";
?>
Also the line below has one single quote.
Code:
$row['feild1] . "</td>";
Surprised you did not get an error message on that. Suggestion: turn PHP error messages on, it really saves time in development.
__________________
Best Regards,
Randy
Reply With Quote
  #10 (permalink)  
Old 10-01-2008, 07:30 PM
WebProWorld New Member
 

Join Date: Sep 2008
Posts: 18
ryanhouston RepRank 0
Default Re: PHP PROBLEM: Cannot carry $_post through multiple pages.

how do i turn php error message on ??? and you aren't seeing an error because i have fixed it
Reply With Quote
  #11 (permalink)  
Old 10-01-2008, 09:13 PM
DaveSawers's Avatar
WebProWorld Veteran
 

Join Date: Dec 2006
Location: Calgary, Alberta, Canada
Posts: 389
DaveSawers RepRank 1
Default Re: PHP PROBLEM: Cannot carry $_post through multiple pages.

Quote:
Originally Posted by ryanhouston View Post
how do i turn php error message on
Put:

error_reporting(7);

at the beginning of each script. Take it out again before going live. See PHP: error_reporting - Manual for more info.
__________________
Dynamic Software Development
www.activeminds.ca
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Do noindex,follow pages carry weight seopo Search Engine Optimization Forum 11 05-30-2008 06:29 PM
Music playing across multiple pages getmea Web Programming Discussion Forum 1 12-09-2006 05:02 AM
Need help - multiple domains problem---- tcady Search Engine Optimization Forum 0 05-20-2005 11:27 AM
multiple pages for same keyword burkey Search Engine Optimization Forum 0 03-18-2004 01:31 PM
%_POST and $HTTP_POST_VARS Server Problem yanra Web Programming Discussion Forum 0 02-27-2004 07:32 AM


Search Engine Optimization by vBSEO 3.2.0