Results 1 to 2 of 2
  1. #1
    Senior Member JMCDesigner's Avatar
    Join Date
    Aug 2009
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts

    php sticky form fields wont update

    I have a form which loads its values from a text file. When I update a field and press submit, the text file is updated with the new value but the sticky field still shows the prior value. Can anyone enlighten me as to what I've done wrong? My brain has become mush...

    form fields look like this:

    Code:
    <input type="text" name="businessname" id="businessname" <?php stickyfield($SET_BNAME); ?>/>
    external config file (php include) looks like this:

    Code:
    function stickyfield($fieldname){
    if(isset($fieldname)){echo ' value="'.trim($fieldname).'"'; };
    };
    I have ommited the other data but $SET_BNAME refers to the array element im extracting from the text file as follows:

    Code:
    $settingsfile = file(SETTINGS);
    
    for ($i = 0; $i < count($settingsfile); $i++) {
    // separate each element and store in a temporary array
    $tmp = explode(': ', $settingsfile[$i]);
    // assign each element of the temporary array to a named array key
    $settingsfile[$i] = array('setting' => $tmp[0], 'value' => $tmp[1]);
    }
    $SET_BNAME = trim($settingsfile[0]['value']);
    (SETTINGS is defined to text file location)



    HOW IT WORKS/DOESNT WORK:


    1. My form input field reads specific line from text file and makes field value (as an example) 'plumbing inc'
    2. I change the input field to 'electrician inc' and press submit
    3. The specific line on the text file is updated to 'electrician inc', but the form field still says 'plumbing inc'

  2. #2
    Senior Member JMCDesigner's Avatar
    Join Date
    Aug 2009
    Posts
    222
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Fair enough....solved it myself...I put a header location redirect and changed text field code

    Code:
    <input type="text" name="businessname" id="businessname" <?php if (!in_array('businessname', $missing)){stickyfield($SET_BNAME);} ?>/>

Similar Threads

  1. Adding Sticky? Text To A Image....
    By drizzyjames in forum Graphic Design Forum:
    Replies: 1
    Last Post: 10-28-2010, 11:45 AM
  2. Website wont appear in IE, Help me please?
    By VinnyisSkinny in forum Website Coding & Programming Forum:
    Replies: 8
    Last Post: 06-10-2010, 07:44 PM
  3. Problem with form fields in Acrobat
    By andywpeat in forum Graphic Design Forum:
    Replies: 1
    Last Post: 01-26-2010, 05:26 PM
  4. Portfolio Update
    By nickio15 in forum Graphic Design Critique:
    Replies: 4
    Last Post: 12-02-2009, 05:47 PM
  5. Sticky notes at the ready...
    By Ozwaldo Sanchez in forum Graphic Design Critique:
    Replies: 0
    Last Post: 03-31-2009, 01:01 PM

Posting Permissions

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