Web Design Forum: How to automatically append text to a form field? - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to automatically append text to a form field? Rate Topic: -----

#1 User is offline   Charlie 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 150
  • Joined: 08-August 09
  • Reputation: 0
  • Gender:Male
  • Location:England, UK.
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 04 January 2012 - 10:55 PM

I'm creating a donation form with PayPal that I'm creating for help fund a game server. I need to record the users in-game username, I have setup the field that will record the name. Now how can I automatically append some text to that SAME field that the user won't be able to remove or see?

Thanks,
0

#2 User is offline   itodd 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 111
  • Joined: 17-April 11
  • Reputation: 29
  • Gender:Male
  • Location:UK
  • Experience:Advanced
  • Area of Expertise:Designer/Coder

Posted 05 January 2012 - 12:27 AM

How does your form work, do you have an example?

Do you simply want to know the html? If so use the following code for a hidden form input:

<input type="hidden" name="username" value="Echo username and text here"/>

0

#3 User is offline   Charlie 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 150
  • Joined: 08-August 09
  • Reputation: 0
  • Gender:Male
  • Location:England, UK.
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 05 January 2012 - 12:23 PM

View Postitodd, on 05 January 2012 - 12:27 AM, said:

How does your form work, do you have an example?

Do you simply want to know the html? If so use the following code for a hidden form input:

<input type="hidden" name="username" value="Echo username and text here"/>



Basically it uses a single text field that it passes to PayPal for the item description, I need to description to be "GAMEUSERNAME (Donation from site)" whereby the username is entered into the field by the user, and the text in brackets is somehow also added to the end of the video before it is submitted?
0

#4 User is offline   itodd 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 111
  • Joined: 17-April 11
  • Reputation: 29
  • Gender:Male
  • Location:UK
  • Experience:Advanced
  • Area of Expertise:Designer/Coder

Posted 05 January 2012 - 12:38 PM

Do you have a live example? You could process one form with the username & donation and then send the data to the paypal form and automatically submit
0

#5 User is online   kensha 

  • Expert
  • PipPipPipPip
  • Group: Members
  • Posts: 870
  • Joined: 12-August 10
  • Reputation: 17
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 05 January 2012 - 12:44 PM

How about you store all the information that you need in a $_SESSION[''].

For example

$_SESSION['user']=$_POST['user'];

On all pages the <?php session();?> must be at the top.

This is the only way to move data from 1 page to another.


But give us something of a live example cause it is quite confusing.

This post has been edited by kensha: 05 January 2012 - 12:45 PM

0

#6 User is offline   itodd 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 111
  • Joined: 17-April 11
  • Reputation: 29
  • Gender:Male
  • Location:UK
  • Experience:Advanced
  • Area of Expertise:Designer/Coder

Posted 05 January 2012 - 12:53 PM

View Postkensha, on 05 January 2012 - 12:44 PM, said:

This is the only way to move data from 1 page to another.


No it's not, $_POST["var"] (or $_GET["var"] although less preferred) can be used without worrying about sessions. Then send to a page which processes the data and automatically submits the second form possibly using something like:

<script LANGUAGE="JavaScript"><!--
setTimeout('document.paypal.submit()',1);
//--></SCRIPT>

0

#7 User is offline   empek 

  • Wordpress Geek
  • PipPipPipPip
  • Group: Members
  • Posts: 774
  • Joined: 17-December 08
  • Reputation: 76
  • Gender:Male
  • Location:New York City.
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 05 January 2012 - 01:09 PM

You could have the form submit the username to another form via , which prepends the username value to your sentence, and then submit that to Paypal.

itodd beat me to it.

This post has been edited by empek: 05 January 2012 - 01:11 PM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users