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="myemail@email.com">
<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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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"; ?>>

Link to comment
Share on other sites

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.