Well, it's clearer, but wow, this is some messy stuff. Ok, so there's a hidden field named 'pusr' that starts out with the value "". Then some pretty sketchy-looking javascript takes the URL of the page, breaks it up by splitting it on &, then breaks up each part of that by splitting on =, and for each of those, assigns the second half as the value of the hidden field named 'pusr'. (But see my last paragraph for why it doesn't actually do that either.)

So if the URL is something like http://example.com/index.pl?type=search&user=john, then first it'll set 'search' as the value of the 'pusr' field, and then it'll assign 'john' as the value. So what gets assigned will be the value of the last pair in the URL.

Since we don't know the URL, we can't really diagnose any further here. My next step (short of scrapping all this and starting over) would be to put an alert after the document.getElementByID line, so you can see what's being assigned. Something like alert(acc_usr);. That'll show you how many values are being extracted from the URL, and which is the last one found.

Oh, and there's another problem: getElementById is looking for an element with id='pusr', but there isn't one, so that assignment does nothing (except maybe throw a javascript exception). There's a difference between name='pusr' and id='pusr', so you may want your hidden field to have both.


In reply to Re^3: y username is empty by aaron_baugher
in thread y username is empty by sasidhardv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.