![](/img/trans.png)
[英]How can I retrieve the text next to a radio button when scraping HTML using PHP?
[英]How can I retrieve the contents of a HTML text box from PHP in response to a button click?
在以下HTML頁面上放置文本框,然后在不重新加載頁面的情況下 ,當用戶單擊按鈕時以PHP獲取其內容的最佳方法是什么?
<?php require_once "phpuploader/include_phpuploader.php" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Simple File Upload - use SaveDirectory property</title>
<link href="demo.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="demo">
<h2>Attach some files</h2>
<p>Attach some files using the button below.</p>
<ul>
<li>Allowed file types is set to: jpg, gif, png, zip
- multiple files (Max 10M)</li>
</ul>
<?php
$uploader=new PhpUploader();
$uploader->MultipleFilesUpload=true;
$uploader->InsertText="Upload Now";
$uploader->MaxSizeKB=10240;
$uploader->AllowedFileExtensions="jpeg,jpg,gif,png,zip";
$uploader->SaveDirectory="savefiles";
$uploader->Render();
?>
</div>
</body>
</html>
我知道我可以使用表格和發布,但我想保留在同一頁面上。
從技術上講,如果您將表單發布到其自身,則將停留在同一頁面上。 這且不說,你唯一的辦法就是AJAX。
自從我使用PHP已經有一段時間了,但是我想如果您想避免回發時需要AJAX,那么請問。
以下鏈接可能會幫助您:
好吧,最簡單的答案就是提交到同一頁面:
<form action=""></form>
如果執行此操作並將表單處理代碼添加到PHP文件的頂部,則可以提交,處理POST變量,但也要保留在同一頁面上。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.