redirecting a changed password etc using form

3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 1, 2017   (RSS)

Hello,
I was wondering how to auto submit a form,

when a user changes for instances a password using the membership plugin we have the following thus

      // on success
     websiteLogin_setLoginTo( $colsToValues['username'], $CURRENT_USER['password'] );  // update login session username in case use has changed it.
      $errorsAndAlerts = "Thanks, we've updated your profile!<br/>\n";
      header("Location: http://www.mysitename.com/index.php?blabla=1");  // me here

I can add this and bingo it codes to mysitename.com/index.php passing the value of the variable "blabla", thus I can have and if else aka

 <?php
$blabla = (isset($_GET["ref"]));
if($blabla != null)
{
    echo '<div style="color: #C00;">';    
    //echo $blabla;
    echo "<input type=\"button\" value=\"Login Here &gt;&gt;\" onclick=\"window.location.href='user-login.php'\">";
    echo "<br/><br/>\n";
    echo '</div>';
    }
    ?>

My question is, were I to want to do this using a form thus

echo "<form>";
echo "<form action='user-login.php' method='post'>";
echo"<input name="ding" type="hidden" id="ding" value="123">";
echo "<input type=\"submit\">"; //// does not work lol
echo "</form>";

is there a way that I can have the form auto submit?

I have tried

echo "<form>";
echo "<form action='user-login.php' method='post'>";
echo"<input name="ding" type="hidden" id="ding" value="123">";
echo "<script type="text/javascript">";
echo "document.getElementById("?").submit(); ";
echo "</script>";
echo "</form>"

But it didnt work, If I am on the wrong track just delete the question and I will understand.

cheers

Kenny

By Twocans - March 1, 2017

Hi yea,
I got it to work, I think its safe anyway, let me know any suggestions to make it safer if you can.

//header("Location: http://www.mysitename.com/index.php?ref=1");

echo "<form action=\"index.php\" method=\"post\" id=\"t1\">";
echo "<input name=\"confirmtest11\" type=\"hidden\" id=\"confirmtest11\" value=\"1\" />";
echo "<script type=\"text/javascript\">document.getElementById('t1').submit()</script>";
echo "</form>";
$_REQUEST = array(); // clear form values
$showSignupForm = false;
}
?>

then on the index page I have

<?php

$blabla = (isset($_POST["confirmtest11"]));
if($blabla != null)
{
echo '<div style="color: #C00;">';
//echo $blabla;
echo "ding dong.<br/>\n";
echo "<br/><br/>\n";
echo '</div>';
}
?>

cheers

Kenny