亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在已經從頁面接收數據后使用 PHP 將數據發送到另一個頁面

在已經從頁面接收數據后使用 PHP 將數據發送到另一個頁面

PHP
婷婷同學_ 2023-04-02 15:06:45
我想做的是:在將數據從 form.php 發送到 data_received.php 之后,我希望 data_received.php 將其發送到 pdf.php,而無需用戶填寫另一個表格。那可能嗎?這是東西form.php 的表單示例<form action="data_received.php" method="post"><div data-for="date">                        <label>Date</label>                        <input type="text" name="date">                    </div><div data-for="time">                        <label>Time</label>                        <input type="text" name="time">                    </div>data_received.php:<?php$date = $_POST['date'];$time = $_POST['time'];echo '$date';echo '$time';?><button onclick="window.location.href = 'pdf.php';">Print to pdf </button><button onclick="windoe.location.href = 'form.php';>Back</button>我只想知道如何讓用戶對 pdf.php 的 $date 和 $time 的回答
查看完整描述

2 回答

?
隔江千里

TA貢獻1906條經驗 獲得超10個贊

解決方案在這里!


表單.php


<html>

<head>

    <title>Log-in</title>

    <link rel="stylesheet" type="text/css" href="style.css">

</head>

<body>

<div class="header">

    <h1>Log-in</h1>

</div>


<form action="data_received.php" method="post">


<div data-for="date">

                        <label>Date</label>

                        <input type="text" name="date">

                    </div>

<div data-for="time">

                        <label>Time</label>

                        <input type="text" name="time">

                    </div>

                    <input type="submit" name="register_btn" class="Register"></td>

</body>

</html> 

data_received.php


<html>

<head>

    <title>Log-in</title>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

    <script>

    $(window).on('load', function() {

    window.open("pdf.php", "pdf", "height=400,width=400");

    })

    </script>

</head>

<body>

<div class="header">

    <h1>Log-in</h1>

</div>


<form >

   <?php

session_start();

$date = $_POST['date'];

$time = $_POST['time'];

$_SESSION["date"] = $_POST['date'];

$_SESSION["time"] = $_POST['time'];

echo $date;

echo '<br/>';

echo $time;

?>

<br/>

<input type="Button" value="Back" onclick="windoe.location.href ='form.php';">

<input type="Button" value="Print to pdf " onclick="window.location.href = 'pdf.php';">


</form>

</body>

</html> 

pdf文件


<html>

<head>

    <title>Log-in</title>

    <link rel="stylesheet" type="text/css" href="style.css">

</head>

<body>

<div class="header">

    <h1>PDF</h1>

</div>

<form method="post" >

    <?php

    session_start();

    ?>

    <table>

        <tr>

            <td>Date:</td>

            <td><input type="text"  value="<?PHP if(isset($_SESSION['date'])){echo $_SESSION['date'];}?>"></td>

        </tr>

        <tr>

            <td>Time:</td>

            <td><input type="text" value="<?PHP if(isset($_SESSION['time'])){echo $_SESSION['time'];}?>"></td>

        </tr>

        <tr>

            <td></td>

            <td><input type="Button" value="Close" onclick="self.close();"> </td>

        </tr>

    </table>

</form>

</body>

</html> 


查看完整回答
反對 回復 2023-04-02
?
尚方寶劍之說

TA貢獻1788條經驗 獲得超4個贊

解決方案在這里!針對你的疑惑,我已經計劃好了,希望對你有用。

http://img1.sycdn.imooc.com//642929e40001f67b04920471.jpg


查看完整回答
反對 回復 2023-04-02
  • 2 回答
  • 0 關注
  • 135 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號