我有一个输入字段,我粘贴了一个网址,我想从网址中获取详细信息。现在获取结果后,我无法将这些值分配给输入字段。您可以看到链接here
<form action="" method="POST">
<input type="text" name="ref_url" placeholder="Paste the URL" value="https://www.lovely-cards.com/wedding-cards/1836-ethnica01.html">
<input type="submit" value="Get Details">
</form>
<input type="text" name="height" value="<?php echo $tags[0]['height']; ?>">
PHP
<?php
include('simple_html_dom.php');
if (!EMPTY(isset($_POST['ref_url']))) {
$url = $_POST['ref_url'];
$html = file_get_html($url);
$row = $html->find('tr');
unset($row[0]);
unset($row[1]);
foreach($row as $element) {
$tag_name = $element->find('td',0)->plaintext;
$tag_value = $element->find('td',1)->plaintext;
if (!EMPTY($tag_name) && !EMPTY($tag_value)) {
$tags[] = array($tag_name =>$tag_value);
}
}
echo '<pre>';
print_r($tags);
echo '</pre>';
}
?>
答案 0 :(得分:0)
它的'高度'不是你试图设置的'高度'