dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Sending Input to a hidden box

  1. #1
    Join Date
    Dec 2009
    Posts
    6

    Sending Input to a hidden box

    Hey all. Very Greenhorn coder here. Enough to have any idea where to look and to try things.

    I am trying to get the below to go into two table


    <p class="input">
    <label for="username"><?php echo $this->translate('Username');?> <br class="hide" /></label>
    <span class="field"><input type="text" name="username" id="username" value="<?php echo $this->username;?>" /></span>
    <span class="addtext"><?php echo $this->baseUrl;?>username</span>
    </p>
    <p class="input">
    <label for="firstname"><?php echo $this->translate('Screen Name');?> <br class="hide" /></label>
    <span class="field"><input type="text" name="firstname" id="firstname" value="<?php echo $this->firstname;?>" /></span>
    </p>

    What I essentially want to happen is hide the Screen Name section, but have whatever is typed into the Username box, be auto-copied to the Screen Name box (while its hidden).

    The other method that would work, would be to tell mySQL to copy anything from table A to table B. However, I am having more issues trying to figure out the mysql function for this, so thought I would try working on things from the front end.

    Any ideas? Or am I way off on this?

  2. #2
    Join Date
    Dec 2009
    Posts
    6
    I assume I am way off then.

  3. #3
    Join Date
    Dec 2012
    Location
    NSW Australia
    Posts
    73
    Yes you are way off.....

    Summarising: you would like to have the *Username* and *Screen Name* identical (one and the same), and then have one of them inserted into a database table A and the other into table B....

    For starters WHY have the form make a duplication of the *Username* especially if it is going to be the same? Send just the *Username* to the server, validate it and then write an insert query for each of the tables. That way you have an exact copy of the *Username* in each of the database tables in question, keeping in mind the *screen Name* is required to be identical.

    JavaScript can do weird and wonderful things but the least it does the better, leave it up to the server because it is the final frontier for defence against the nasties.

  4. #4
    Join Date
    Dec 2009
    Posts
    6
    Thanks for your reply. The form was just the standard default I am working to change. So indeed there will not be two of the same questions. I thought I would share it so that any edits could be made to it.

    Right now, my biggest issue is trying to figure out where the server process file is. If I can find that, then I assume I can change a line in for "Screen Name" to actually populate to the table I want.

    I am trying to work it from both angles, backend and front end, thought I would check in here if there were ideas on the front end. This is all jquery stuff.

    Edit 1: here is the validation, however still trying to find the actual file that sends the data to mysql.

    if( $request->isPost() ) {

    $validate = new Helper_Validate();
    $validate->_set_rules($request->getPost('username'), $this->translate('Username'), 'not_empty;min_length[3];max_length[100];username');
    $validate->_set_rules($request->getPost('email'), $this->translate('Email'), 'not_empty;min_length[5];max_length[100];email');

    $data = $request->getPost();
    Last edited by tek0011; 03-05-2013 at 12:10 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles