Web Analytics Made Easy -
StatCounter PHP echo information in a form field? - CodingForum

Announcement

Collapse
No announcement yet.

PHP echo information in a form field?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP echo information in a form field?

    I'm hoping you all can help me with something. I have a form for the user to fill out with some information. What I would like is when they fill in certain fields, the information that's entered there will be printed, or echoed, in the sidebar. So for example say they fill out a field called "domain url". When they fill that out the url they enter will show up in the sidebar.

    Sounds like a PHP thing but I'm not sure where to start. Would appreciate any advice! Thank you!

  • #2
    You need a database to hold the information they enter.
    Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?

    Comment


    • #3
      While masterofollies is most certainly correct if you intend to save the information once they leave the website (assuming you don't do $_COOKIE(s) of course) you could use sessions to save this web page and then show it.

      The only way you could accomplish this is with frames. You would dynamically set the source of the frame to the field that you saved in the session.

      For example, <iframe src="<?php echo( $_SESSION['savedWebDomain'] ); ?>" />.
      Unless otherwise stated, any code posted is most likely untested and may contain syntax errors.

      Comment


      • #4
        Originally posted by jessnoonyes View Post
        I'm hoping you all can help me with something. I have a form for the user to fill out with some information. What I would like is when they fill in certain fields, the information that's entered there will be printed, or echoed, in the sidebar. So for example say they fill out a field called "domain url". When they fill that out the url they enter will show up in the sidebar.

        Sounds like a PHP thing but I'm not sure where to start. Would appreciate any advice! Thank you!

        the easiest way I found to echo into a from input is to use the shorten echo command, like this

        Example:
        Code:
        <input type="hidden" name="number" value="<?=$number;?>">
        the <?= is a shorten way of saying echo

        <?=$variable;?> same as <? echo $variable; ?>

        Comment


        • #5
          While you could use <?=$variable;?> instead of <? echo $variable; ?>, you really should not to use either one of them. To prevent interoperability issues it is recommended to use <?php echo $variable; ?>.
          .My new Javascript tutorial site: http://reallifejs.com/
          .Latest article: Calculators — Tiny jQuery calculator, Full-fledged OOP calculator, Big number calculator
          .Latest quick-bit: Including jQuery — Environment-aware minification and CDNs with local fallback

          Comment

          Working...
          X