gally Posted August 26, 2009 Share Posted August 26, 2009 Hi guys, I have a form in a php file which calls another file for the elaboration. When job ends a submit command returns to the main form in the first file. How can I return "immediately" to the main form without the submit command? Thank you in advance Quote Link to comment https://forums.phpfreaks.com/topic/172001-returning-to-the-form/ Share on other sites More sharing options...
Vivid Lust Posted August 26, 2009 Share Posted August 26, 2009 I dont understand Algorithm? Quote Link to comment https://forums.phpfreaks.com/topic/172001-returning-to-the-form/#findComment-906939 Share on other sites More sharing options...
AviNahum Posted August 26, 2009 Share Posted August 26, 2009 i dont understend.... can you post here you code and explain better? Quote Link to comment https://forums.phpfreaks.com/topic/172001-returning-to-the-form/#findComment-906958 Share on other sites More sharing options...
gally Posted August 26, 2009 Author Share Posted August 26, 2009 Im sorry but english is not my mother tongue so its difficult for me to explain what I want. I have a "main" file (A) with a form. The "action" command of this form is to call another file (B) which processes the data received from the previous form. When elaboartion is over, following code ask the user if he wants to return to the "main" form to introduce new data. <p align = "center"><form method="get" name="bidibodibu" action="main.php"> <input align="center" value="Again" type="submit"></p> </form> Well, what I would like is a piece of code which allows the user to return to the "main" form without having to click on "Again". I mean: as soon as the process is over the user is presented with the "main" form. Again... the script on file (B) must return control to file (A) instead of waiting the choice of the user If the user (me .-) ) doesnt want to introduce new data leaves the script in other ways. Quote Link to comment https://forums.phpfreaks.com/topic/172001-returning-to-the-form/#findComment-906961 Share on other sites More sharing options...
AviNahum Posted August 26, 2009 Share Posted August 26, 2009 it's ok, i'm not an english speaker too... i think i understend what you trying to do... you can do this with one file: <html> <body> <?php echo $message; ?> <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="hidden" name="send" value="1"> <input type="submit"> </form> <?php if (isset($_GET['send']) && $_GET['send'] == 1) { $message = "<b>the form sent!</b>"; // put here your code } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/172001-returning-to-the-form/#findComment-906975 Share on other sites More sharing options...
mikesta707 Posted August 26, 2009 Share Posted August 26, 2009 you could also use a php header //after form process header('Location: http://www.example.com/'); just make sure there is no output before you call that function, or you will get a header error. Output being any echos, prints, any HTML at all, etc. Quote Link to comment https://forums.phpfreaks.com/topic/172001-returning-to-the-form/#findComment-907013 Share on other sites More sharing options...
gally Posted August 26, 2009 Author Share Posted August 26, 2009 if Im not wrong your code makes a check to see if the form is sent or not. If so, is not my whish. Be patient. I try to explain it in another way. This is the situation: file main.php usual stuff here <form method="POST" name="onename" action="foo.php"> .... other stuff here .... <input align = "center" type="submit" value="Scegli"> </form> file foo.php <html> <body> <?php .... elaboration here .... ?> [color=red]<form method="get" name="whatyouwant" action="main.php"> <input value="Again" type="submit"> </form> [/color] <----- the red should be removed [color=green]go [b]imeediately[/b] to "main.php" without asking[/color] this is what I vould like </body> </html> Hope this time the example is clear Quote Link to comment https://forums.phpfreaks.com/topic/172001-returning-to-the-form/#findComment-907041 Share on other sites More sharing options...
mikesta707 Posted August 26, 2009 Share Posted August 26, 2009 <html> <?php .... elaboration here .... header('Location: path/to/file.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/172001-returning-to-the-form/#findComment-907051 Share on other sites More sharing options...
gally Posted August 26, 2009 Author Share Posted August 26, 2009 Thank you very much, Ill try it immediately and let you know Quote Link to comment https://forums.phpfreaks.com/topic/172001-returning-to-the-form/#findComment-907054 Share on other sites More sharing options...
gally Posted August 26, 2009 Author Share Posted August 26, 2009 OK!!! Its perfect. THANK YOU VEY MUCH AGAIN. I dont know the procedure, but someone should add "SOLVED" Quote Link to comment https://forums.phpfreaks.com/topic/172001-returning-to-the-form/#findComment-907073 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.