Jump to content

Get First Name Without Form?


paulmo

Recommended Posts

1) How to get user First Name as unobtrusively as possible, withoutuser having to fill out form <input type="text" name="name" />? (I donot have a "log in" component to my app, nor do I want one.)2) How to submit radio button form, when the user clicks the radiobutton, without having to click a submit button?

Link to comment
Share on other sites

I cannot imagine a way to get a name without a text input of some kind. Maybe I misunderstand.Your radio buttons could have an onchange handler, either in the tag, or assigned in your script. I'd think about the plan long and hard, though. Users don't mind when a page updates in response to an action like that, but changing location without a link or submit button can be pretty unwelcome.

Link to comment
Share on other sites

Yes, the page would update depending on their radio selection. I am not sending them to another location or unwelcome situation. Thanks for advice on onchange handler. Any advantage over in tag or in script?As to First Name, is it possible to get previously stored cookie from other forms, e-mail, etc. that I could use in greeting user? Users often just leave the first name blank in my form :) If I can't get pre-existing cookie name, I will have to alert user to fill in first name field. I have two forms on same page, that BOTH require first name. I only have one name field because I don't want 2 on my page for aesthetic reasons. At the moment, it's kind of a pain that the user has to write their name, then click submit on first form, for their name to be sticky for 2nd form. I would like to have ONE name field that covers both forms, where EITHER submit (well, in radio form will be onchange handler) generates sticky name, so user does not have to do one form first just to get sticky name for 2nd form. My site is here if it helps. Thanks in advance for help!

Link to comment
Share on other sites

Some developers have a strong philosophical belief that structure, presentation, and behavior should be separated into different parts of a document. These correspond to HTML, CSS, and JavaScript. Strong believers in this philosophy prefer to have no JavaScript in any tag.But it is a philosophy, not a set of rules.In most practical situations, there is no real advantage one way or the other. If you just want to get the job done, do what makes sense to you.

Link to comment
Share on other sites

Great, that's a bit different than the

<input type="hidden" name="check_submit" value="<?php echo $post_name;?>"/>

I use now to sticky the name to 2nd form. I will have to style the generic alert box as well. If I copy/paste that code from w3 example, can I get rid of "name" form field altogether, but still use

$name = mysql_real_escape_string($_POST['name']);

in my script to insert value in database table, etc? I need to be able to use the name as a variable. Also how would I get return CapitalizeNames() in that cookie?Thanks for help.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...