<script> document.location.href =''; </ script>&转到页面相关问题

<? echo "<script> document.location.href='main.php';</script>"; ?>

This code is running well

But, sending values ​​from the form page

<form action="smssend.php" method="post" id="quickform"> 
<input type="hidden" name="returnUrl" value="<? =PHP_SELF?>"> 

This gives a value to the next page

<? echo "<script> document.location.href='$_POST[returnUrl]';</script>"; ?>

Run time error occurs if the source and the page will not move.

Does what I'm wrong?

Under the form page I received the message from the phone number with reference to the page source to handle less.

<?php

$config['SMS_ID']="test";
$config['SMS_PW']="test1234";
$config['cf_tel']='01234567';

$post_data = array(
            "remote_id"       => $config['SMS_ID'],
            "remote_pass"     => $config['SMS_PW'], 
            "remote_num"      => 1, 
            "remote_reserve"  => 0, 
            "remote_phone"    => $_POST[number],
            "remote_callback" => $config['cf_tel'],
            "remote_msg"      => $_POST[counsle]
        );

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.mymunja.co.kr/Remote/RemoteSms.html" );
curl_setopt($ch, CURLOPT_POST, 1 );
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$msg = curl_exec($ch);
curl_close($ch);
?>
<? echo "<script> alert('Done');</script>"; ?>
<? echo "<script> document.location.href='$_POST[returnUrl]';</script>"; ?>

Try use <html></html> tag.

<? echo "<html><script> alert('Done');</script></html>"; ?>


<? echo "<html><script> document.location.href='$_POST[returnUrl]';</script></html>"; ?>

My guess is

<input type="hidden" name="returnUrl" value="<? =PHP_SELF?>"> 

should actually be

<input type="hidden" name="returnUrl" value="<?=PHP_SELF?>"> 

View source of your form and make sure the value of your hidden input has the correct value.

<? echo "<script> document.location.href="$_POST[returnUrl]";</script>"; ?>

your problem is with string delimiters