Jump to content


Photo

[Javascript/HTML] Insert name


  • Please log in to reply
4 replies to this topic

#1 Versatile

Versatile

    Young Padawan

  • Members
  • Pip
  • 8 posts
  • Gender:Male

Posted 21 March 2012 - 02:37 PM

I'm looking for a tutorial or script which will let you enter your name in a Form. When you click on the submit button you will be redirected to the next page. The form saves your name (probably with a cookie). On the next page I put in a question and in that question is also the name, which was just filled in by the visitor.

Is there anybody who knows what I mean and where I can find a tutorial or script? Or maybe do you know the words I should search for on Google/P2L?
  • Sweeledualeri and UnuttPeseleme like this

#2 Aalicki

Aalicki

    Young Padawan

  • Members
  • Pip
  • 4 posts

Posted 09 April 2012 - 12:33 PM

Would you be open to doing this in PHP? In my opinion, doing this in PHP is simple and can easily be implemented (also, for me, easier to do that JS)

#3 rosstanner

rosstanner

    Young Padawan

  • Members
  • Pip
  • 2 posts

Posted 11 April 2012 - 01:04 PM

I wouldn't suggest using JS to do this. As Aalicki mentioned, it would be much easier to achieve using PHP. The form would look similar to:

<form method="POST">
<label for="name">Enter your name</label>
<input type="text" name="name" id="name" />
<input type="submit" value="Submit" />
</form>

So once the form is submitted you would output the question as follows:

<p>What is your favourite colour, <?php echo $_POST['name']; ?></p>

Does that make sense?

#4 WSimpson

WSimpson

    P2L Admin

  • Admin
  • 59 posts
  • Gender:Male
  • Interests:P2L admin, graphic designer, cat lover, books and comics addict.

Posted 04 November 2012 - 04:18 PM

Hello, JatOffets, it's okay for this time :)
Maybe you'd like to post in the general discussion forum, we have a topic for those who are new to the forum.
Welcome to Pixel2Life!

#5 akashbhai

akashbhai

    Young Padawan

  • Members
  • Pip
  • 1 posts
  • Gender:Male

Posted 24 March 2015 - 11:48 AM

Finally i got it! thank you very much for sharing.


Edited by akashbhai, 24 March 2015 - 11:49 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users