【发布时间】:2010-12-23 17:38:33
【问题描述】:
是否可以在表单字段中发布字符串并在同一表单字段中获取转换后的字符串结果?
我使用代码:
<?php
$string='';
if (isset($_POST['string']))
$string=$_POST['string']
if (isset($_POST['DoStuff']))
{
$string = doStuffWithThisString($string);
}
if (isset($_POST['DoOtherStuff']))
{
$string = doOtherStuffWithThisString($string);
}
?>
<form action="" method="post">
<!-- blank action attribute will post form to the current page-->
<input type="text" value="<?=$string?>" name="string" />
<!-- <?=$string?> is the same as <?php echo $string; ?> -->
<input type="submit" value="Do Stuff" name="DoStuff" />
<input type="submit" value="Do Other Stuff" name="DoOtherStuff" />
</form>
但是得到表单域上方的结果...
【问题讨论】:
标签: php oop web-applications webforms