Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2007
    Location
    Leeds - UK
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Posting a Variable into a text box

    Hello all

    I have a query about posting a variable into a text box. Mainly to see if anyone has any good references or can give me some instructions. I'm a fairly newcomer to PHP so any help is appreciated.

    I have a form and a list of items that can be used to fill out the form and then submit to a database. I would like to make the list of items into a list of hyperlinks, so that when I click on one of these the item will get added to the text box in my form.

    I have the value as a variable, as they are pulled from a database, so how can I post this back to the page and then into the textbox...

    Anyone with ideas?

    Form to add to:
    PHP Code:
    <form action "entered_data1.php" method "post"
    enctype "multipart/form-data" name="form01">
      <
    table width="95%" border="0" cellspacing="0" cellpadding="3">
        <
    tr>
          <
    td><class="subHeader">ID</p></td>
          <
    td><input name="product_id" type="text" value=" " size="30" maxlength="30" /></td
    Written to page as so:
    PHP Code:
    <?php echo "<a href='#'>" .$titlehigh"</a>" ?><br>
    Anything else?

    Thanks.
    Last edited by sjwatsi; 02-26-2008 at 09:47 AM. Reason: tags

  • #2
    Banned
    Join Date
    Feb 2008
    Location
    Winnipeg, Canada
    Posts
    396
    Thanks
    0
    Thanked 29 Times in 29 Posts
    I'm confused but if you want the variable $titlehigh in a textbox try this:

    PHP Code:
    <input type="text" name="textbox_name" value="<?php echo $titlehigh?>" />

  • #3
    New to the CF scene
    Join Date
    Sep 2007
    Location
    Leeds - UK
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Sorry for the confusion, I'm always doing this .

    I think that is fine, I was just wondering that if I use the line

    PHP Code:
    <?php echo "<a href='#'>" .$titlehigh"</a>" ?><br>
    in a loop of some sort to print multiple of the $titlehigh variables (where the value in $titlehigh changes each time), and then to select one out of the five or so that are printed on the page. I forgot to mention that didn't I..

    If I did what you suggested wouldn't it automatically print whichever value $titlehigh has landed on when the page loads?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •