Jump to content

Recommended Posts

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.

 

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>

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.

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.