xcandiottix Posted October 29, 2010 Share Posted October 29, 2010 The way I understand posting a form to work is that when you hit submit the information is attached to the end of the url of the new page where your script can then get it and use it. I have a form that is an include on a page, like so: thepage.php include: theform.php When i fill out the form and hit submit.. the next page acts as if it has not received any of the posted information. example: echo $_POST['input1'] results in nothing If i go directly to theform.php and fill out and submit the form it works fine. example: echo $_POST['input1'] results in whatever was typed in the first box. So how can I get it to work while being included? Quote Link to comment https://forums.phpfreaks.com/topic/217238-post-on-wrong-url-level/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 29, 2010 Share Posted October 29, 2010 If you were to post actual code that produces the symptom, I'm sure someone can help you. It sounds like invalid HTML to me. Quote Link to comment https://forums.phpfreaks.com/topic/217238-post-on-wrong-url-level/#findComment-1128139 Share on other sites More sharing options...
xcandiottix Posted October 29, 2010 Author Share Posted October 29, 2010 Here's what we've got: the form (it posts back to itself therefore no action): <?php //administration panel, change information within the quotes. $appname = "Shout"; $appcreator = "Kcandiotti400"; $versionnumber = "1.0"; ?> <?php require_once('../includes/tools/applicationframeA.php'); //$xml = simplexml_load_file("../includes/tools/testingUMDOT.xml"); ?> <!-- 3. PHP script for operation of shout box --> <?php //A. Save new post to shouts.txt echo $_SERVER['PHP_SELF']; echo "<BR>"; $myFile = "../includes/2/shouts.txt"; $input = $_POST['2input']; if($input == ""){ //echo $xml->home; } else{ echo $input; //B. Append shouts.txt with new post $username = $xml->visitor; $username = '<a href="http://www.appdilly.com/users/'.$username.'">'.$username.'</a>'; //C. Append shouts.txt or if the file is larger then 1000 bytes erase all and start over with this post. $fh = fopen($myFile, 'a'); if(filesize($myFile) > 1000){fclose($fh); $fh = fopen($myFile, 'w');} //C. End $stringData = $username." - ".$input."<br> \n"; fwrite($fh, $stringData); //B. End } //A. End //D. Open .txt and get all previous shouts $fh = fopen($myFile, 'r'); $shouts = fread($fh,filesize($myFile)); fclose($fh); //D. End ?> <!-- 1. Recent shouts holder --> <?php echo $shouts?> <!-- 1. End --> <form method="post"> <!-- 2. This is the input box for the app --> <input name="2input" type="text" size="30" maxlength="144" /><br /> <input name="2submit" type="submit" value="Shout!" /> <input name="2refresh" type="submit" value="Refresh" /> </form> <!-- 2. End --> <?php require_once('../includes/tools/applicationframeB.php'); ?> So the above, as its own page works just fine. It is included in a really big page, by which an ajax script calls it up. It's a lot of code to post on here but it's live so maybe you can see it in action to help: Just the form working by itself: http://appdilly.com/applications/appfiles/2.php Included on a page: http://www.appdilly.com/member/user_page.php?u=Kcandiotti400 Quote Link to comment https://forums.phpfreaks.com/topic/217238-post-on-wrong-url-level/#findComment-1128145 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.