Sending a variable from a processing page back to the original PHP page

Posted by user1228907 on Stack Overflow See other posts from Stack Overflow or by user1228907
Published on 2012-03-25T17:22:21Z Indexed on 2012/03/25 17:30 UTC
Read the original article Hit count: 183

Filed under:
|

So on a PHP page (page 1) I have some HTML, including :

<form action="create_subject.php" method="post" >

Which goes to a processing page (page 2) containing MySQL which will be executed if there aren't any errors. If there are (checked by validation on the processing page (page 2)) or aren't, certain variables are set, including this one for if it's successful :

if (mysql_affected_rows() == 1){
   $success = 1;
   redirect_to("new_subject.php");
}

However, how would I include $success into the URL without putting it in as :

   redirect_to("new_subject.php?success=1");

I can't do this as I need to do if statements, and it's only PHP on "page 2" so I can't do an if statement inside

redirect_to("new_subject.php");

I know I could do

...
} else {
redirect_to("new_subject.php?success=1");
}

But this would seem mundane and non-semantic especially as I have several variables to proccess.

© Stack Overflow or respective owner

Related posts about html

Related posts about variables