Skip to content

Instantly share code, notes, and snippets.

@fadlisaad
Created June 9, 2022 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fadlisaad/9ee278918369a09f6552e47365d5853e to your computer and use it in GitHub Desktop.
Save fadlisaad/9ee278918369a09f6552e47365d5853e to your computer and use it in GitHub Desktop.
Laravel manual redirect
public static function render($data)
{
$url = 'https://melakapaystg.melaka.gov.my/stom/request';
echo "<form id='autosubmit' action='".$url."' method='post'>";
if (is_array($fieldValues) || is_object($fieldValues))
{
foreach ($fieldValues as $key => $val)
{
echo "<input type='hidden' name='".$key."' value='".htmlspecialchars($val)."'>";
}
}
echo "</form>";
echo "<script type='text/javascript'>
function submitForm() {
document.getElementById('autosubmit').submit();
}
window.onload = submitForm;
</script>";
}
// Sample usage
$data = [
'merchant-code' => 'stom',
'amount' => '100'
];
return $this->render($data);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment