Jump to content

display message on redirect form after submission


alohatofu

Recommended Posts

My form

<form method="POST" action="http://directory_to_formmail/submitform" name="mail_form">
<input type="hidden" name="mailto" value="[email protected]">
<textarea name="message" wrap=physical cols=23 rows=4></textarea>
<input type="submit" value="Send">
<input type="reset" value="Clear">
<input type="hidden" name="redirecturl" value="http://myweb.com/redirect.php>

 

when the user submitted and redirected to redirect.php, I would like to display the $message.

 

 

on redirect.php I have

 

$body = $_POST['message'];

echo $body;

 

but it does not work

 

It seems that you are new to PHP. Please, PLEASE as a very basic security concern use the function htmlspecialchars() on any variable that is collected from user input and displayed on any page. Doing this helps prevent XSS injection attacks.

The code would look like

 

<?php

$sec="5";
echo $_POST[message]."<br><br><b>You will be redirected to $_POST[redirecturl] in 5 seconds</b>";
echo '<meta http-equiv="refresh" content="'.$sec.';url='.$_POST[redirecturl].'"/>';

?>

 

I'm still not sure what you mean by that. Where do i insert that code to? what what does it do?

The code would look like

 

<?php

$sec="5";
echo $_POST[message]."<br><br><b>You will be redirected to $_POST[redirecturl] in 5 seconds</b>";
echo '<meta http-equiv="refresh" content="'.$sec.';url='.$_POST[redirecturl].'"/>';

?>

 

What this means is that it takes the message posted in the form $_POST[message] and your redirect url "$_POST[redirecturl]" and makes a text display...for example

 

This is the users message that will be posted here

 

You will be redirected to www.domain.com/somefile.php in 5 seconds

 

Then it redirects them in 5 seconds

Right, but what I'm trying to achieve is that when the user submit, the form process via the formmail <form method="POST" action="http://webapps/mailer/submitform" name="mail_form">

 

and it's emailing the form to a user. then redirect the user to a page.  right now I got everything working except it does not carry the message over to the new page.  I even did this

 

<input type="hidden" name="redirecturl" value="http://mywebpage/abc/<?php echo "pagingtestconfirm.php?message=$POST_['message']&itemId=$itemId&memberId=$memberId"; ?>>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.