所以我想在id =“id_input”中写一个链接,当我按下按钮name =“b”时,我希望该链接转到$ html-> load_file()行中的page2.php;然后从page2.php的变量$ slbl传递给textarea name =“desc_name”中的page1.php。
我是网络编程的新手,我正在学习,所以如果你愿意,请向我解释。 我尝试了所有我能找到但却没有成功的东西。因为我需要解释这个例子。
page1.php中
<html>
<body>
<?php
include ("page2.php");
?>
<form action="page1.php" method="post" enctype="multipart/form-data">
<div>
<div><textarea name="desc_name" rows="7" cols="50" id="id_desc" value="<?php echo (isset($slbl))?$slbl:'';?>"></textarea></div>
<div><input id="id_input" type="text" name="name_input" size="50">
<button name="b" type="button">Button</button></div>
<div>
<div><input type="submit" name="submit" value="Publish"></div>
</div>
</form>
</body>
</html>
<?php
...code for saving in mysql...
?>
使page2.php
<?php
include ("simple_html_dom.php");
// Create DOM from URL or file
$html = new simple_html_dom();
$html->load_file(<!--i need here url from id="id_input"--!>);
$html = $html->find('.summary_text', 0);
$html2 = strip_tags($html);
$html2 = trim($html2);
$slbl = $html2;
?>
答案 0 :(得分:1)
为什么不为此目的使用jquery?
试试这个:
<?php
if(isset($_POST["a"])) {
$a = $_POST["a"];
include ("simple_html_dom.php");
// Create DOM from URL or file
$html = new simple_html_dom();
$html->load_file(); //you can use $a here as per your need.
$html = $html->find('.summary_text', 0);
$html2 = strip_tags($html);
$html2 = trim($html2);
echo $slbl = $html2;
exit;
}
?>
page2.php:
@ManyToOne
private PetOwner petOwner;