jpowermacg4 Posted January 4, 2007 Share Posted January 4, 2007 I have been working on a php script that's supposed to process php variables to itself..... but I've been unsuccessful at it.I have actually taken the base code from a html sign up form I made not to long ago... and I can process html to php no problem in the same file, which uses php to check the forum and post Red text above the input fields when info is missing.So I use that same processing code to execute a new script I am making.... except this time... I need to actually pass php variable back to itself for processing the output.here is a code snippet of what I have... starting from the first section of php code.[code]<?php if ($_POST['changeinterest']) { echo $interestchange; }echo $interestchangeecho $lstest;echo $testecho;### These 4 echos do nothing currently. This is what I need to make work somehow. ###?></body></html><?phperror_reporting(E_ALL); if ($_POST['changeinterest']) {$interestchange = shell_exec("cd /path/to/bashscript; bash test2");$lstest = shell_exec("cd /path/to/bashscript; ls");$testecho = "Testing Echo";echo $interestchange;echo $lstest;echo $testecho;}?>[/code]I need to actually have this stuff echo'd in the correct locations rather then the bottom of the page.... which is therefore the reason i need to pass these variables back to itself, when the form is submitted.My form uses this and works for actually executing the scripts perfectly.[code]<form name="form" action="<?=$_SERVER['PHP_SELF']?>" method="post"><input type="submit" name="changeinterest" value="Click here to changeinterest"></form>[/code] Link to comment https://forums.phpfreaks.com/topic/32838-posting-php-variables-back-to-self/ Share on other sites More sharing options...
trq Posted January 4, 2007 Share Posted January 4, 2007 [code=php:0]echo $_POST['interestchange'];echo $_POST['lstest'];echo $_POST['testecho'];[/code] Link to comment https://forums.phpfreaks.com/topic/32838-posting-php-variables-back-to-self/#findComment-152865 Share on other sites More sharing options...
jpowermacg4 Posted January 4, 2007 Author Share Posted January 4, 2007 Unfortunately those won't work..... They would work perfectly if they were form input id's.But uh I must be really really sleepy... Cause it's kinda stupid of me trying to pass php variables back to php variable in a file when I could just move the script in the location it will draw at on the page, even though I would have prefered all the actual code work be at the bottom. But I guess I just can't do that the same way with php to php... unlike what you can do with a html form posted to php and then processing a user sign up as the last step of the script.I'll just move the script though. If anyone still wants to answer this, that would be cool also... as I'm probably not the first person who wanted to do this..... but the [code=php:0]if ($_POST['changeinterest'])[/code] will actually work in the direct spot I'll run the script and display the output at. Link to comment https://forums.phpfreaks.com/topic/32838-posting-php-variables-back-to-self/#findComment-152876 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.