简体   繁体   中英

Php - When I require, it gives me a browsing error

I have an input in a html file, wich as its form action on swag.php

<?php
header ('Location: ./teste.php');
$varr = $_POST['amount1'] ;

?>

I have teste.php

<?php 
require 'swag.php';

echo $var2;
?>

And then the input:

<form action="./post_swag/swag.php" method="post">
<input name="amount1" type="text" size="12" maxlength="4" />

<input type="submit">
</form>

When I insert the input's value, it gives me a browsig error, in teste.php, saying that it can't redirect me to the page because firefox detected that the server is rederecting a request to this adress for that the process is never concluded. And then it says that might be disabled cookies... What should I do?

The Location header tells the browser to stop what it's doing and load something else instead. So you have this:

  1. browser requests swag.php

  2. swag.php sends Location header telling the browser to load teste.php .

  3. teste.php loads swag.php , which sends the Location header telling the browser to load teste.php

  4. Repeat step 3 ad infinitum .

Firefox is detecting this infinite loop of redirects and says "I can't do that".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM