weixin_33698823 2014-12-17 18:07 采纳率: 0%
浏览 11

PHP计数器输入字段

Hi i use this PHP script http://www.stevedawson.com/scripts/text-counter.php

And to make it appear on my html page i use this ajax script.

<script>

$.ajax({
    type:'GET',
    url:'http://www.solariserat.se/count.php',
    data:'',
    success: function(data){
            $('#container').html(data);
    }
});

</script>

Together with this html code

<div id="container">    
<?php include "count.php"; ?>
</div>

And it works perfect and it displays the counted numbers inside the div.

But i want it to be displayed as value inside a input tag Is this possible, and how do i do it?

I know this is wrong but you get my point what i want to do =)

<input value="count.php">
  • 写回答

3条回答 默认 最新

  • weixin_33704591 2014-12-17 18:08
    关注

    This should work:

    <input value="<?php include "count.php"; ?>">
    

    However a cleaner approach would be to include the count value in the PHP page that is rendering the <input> so you can do something like this:

    <input value="<?= count ?>">
    
    评论

报告相同问题?