FT3 Posted October 7, 2010 Report Share Posted October 7, 2010 (edited) form.php <form action="index.php?action=form" method="post"> ID:<input type="text" name="id" /> <input type="submit" /> </form> <form action="index.php?action=processscript" method="post"> <input type="text" name="content" value=" <? $id = $_POST['id']; $fn = "inc/data/io_$id.dat"; print htmlspecialchars(implode("",file($fn))); ?> " /> <br> <input type="submit" value="Change!"> </form> processscript.php <? $fn = "inc/data/io_2.dat"; $content = stripslashes($_POST['content']); $fp = fopen($fn,"w") or die ("Error opening file in write mode!"); fputs($fp,$content); fclose($fp) or die ("Error closing file!"); echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php?action=form\" />\n"; ?> Ka lai uzstaisit lai processscript.php scripta , taja 2 vieta ielikt $id no form.php Edited October 7, 2010 by FT3 Quote Link to comment Share on other sites More sharing options...
Code Posted October 7, 2010 Report Share Posted October 7, 2010 Pieliec papildus hidden lauku ar ID, lai caur POST aiziet līdz processscript.php vai arī GET'am pieliec. Quote Link to comment Share on other sites More sharing options...
Roberts.R Posted October 7, 2010 Report Share Posted October 7, 2010 Mans domāt, ka varētu tikt galā ar <? include 'form.php' ?> un tad to $id paņemt no form.php Otrs variants, ko pats izmantoju ikdienā, bez nekādiem liekiem failiem utt, ir šāds: <? if($_POST['input_submit']){ echo $_POST['input_text']; };?> <form method="post" action=""> <input type="text" name="input_text" /> <input type="button" name="input_submit" value="OK" /> </form> Works like a charm :) Tikai aptaisi, ko Tev tur tieši vajag, un visam ir jāstrādā. Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 7, 2010 Author Report Share Posted October 7, 2010 okey pameginašu Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 7, 2010 Author Report Share Posted October 7, 2010 (edited) kautka ta .. <form action="index.php?action=form" method="post"> ID:<input type="text" name="id" /> <input type="submit" /> </form> <? if($_POST['gogo']) { $id = $_POST['id']; $fn = "inc/data/io_$id.dat"; $content = stripslashes($_POST['content']); $fp = fopen($fn,"w") or die ("Error opening file in write mode!"); fputs($fp,$content); fclose($fp) or die ("Error closing file!"); echo "<meta http-equiv=\"refresh\" content=\"0; url=index.php?action=form\" />\n"; } ;?> <form method="post" action=""> <input type="text" name="content" value=" <? $id = $_POST['id']; $fn = "inc/data/io_$id.dat"; print htmlspecialchars(implode("",file($fn))); ?> " /> <br> <input type="submit" value="Change!" name ="gogo" > </form> problema ir tada , viņš ataisa , failu pec id pieprasijuma , bet saglabo to ar nosaukumu io_.datkas man nepareizi ? Edited October 7, 2010 by FT3 Quote Link to comment Share on other sites More sharing options...
FT3 Posted October 8, 2010 Author Report Share Posted October 8, 2010 varat ver ciet , problema izlabota :) Roberts.R paldies par pamatiem ;) Quote Link to comment 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.