提交表单后如何将用户重定向到另一个页面

时间:2018-12-09 19:39:49

标签: php redirect

我想知道在用户提交表单后如何将其重定向到“谢谢”页面。我已经对此进行了研究并尝试了dict函数,但是它不起作用。我不知道是否将其放置在正确的位置。

我的HTML代码是:

records = [{
  "id": 2017215,
  "name": "foo bar"
  "campaign": {
    "id": 161,
    "name": "Historical Data Campaign"
  }
},
{
  "id": 2017215,
  "name": "foo bar",
  "last_updated": "2018-01-01",
  "campaign": {
    "id": 161,
    "name": "Historical Data Campaign"
  }
}]

keys = [ ['id'], ['name'], ['campaign'], ['campaign']['id'], ['campaign']['name'], ['last_updated'] ]

for record in records:
  for key in keys:
    print (record + key) # assumption was this would generate "record['id']" but errors due to mismatched types.

我的PHP代码是:

header("Location: thank-you.html");

任何帮助将不胜感激,谢谢您。

1 个答案:

答案 0 :(得分:0)

将以下内容放在PHP的最后一行。

    class App extends Component {
  constructor(props, context) {
    super(props, context);
    this.state = {
      color: 'white'
    }
    this.changeColor = this.changeColor.bind(this);
    this.resetColor = this.resetColor.bind(this);
  }

  changeColor(){
    this.setState({color:'red'})
  }

  resetColor(){
    this.setState({color:'white'})
  }

  render() {
    return (
      <div className="App">
        <header className="App-header">
          <img src={logo} className="App-logo" alt="logo" />
          <table>
            <tbody>
              <tr onMouseEnter={this.changeColor} onMouseLeave={this.resetColor} style={{backgroundColor:this.state.color}}><td>shiiiiiiiiiiiiiiiiiiiiittttt</td></tr>
            </tbody>
          </table>
        </header>
      </div>
    );
  }
}

export default App;