Textbox Input and put into code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dclamp
Forum Commoner
Posts: 35
Joined: Sun Sep 17, 2006 10:05 am

Textbox Input and put into code

Post by dclamp »

I want to have a page that has a text box where they put in their ID number and they press accept and then it adds it to the end of a URL in some code. here is the code:

Code: Select all

<a href="http://dclamp.homtek.net/invite.php?id=INSERT_HERE"><img src="http://rapidfriends.com/images/logorf.jpg" alt="Promote RapidFriends Networking"></a>
and that is going to be in a <textarea> </textarea> box.

thanks to all the help in advanced!
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

change your form method to "get"

Code: Select all

<form method="get"><input type="text" name="id">
User avatar
dclamp
Forum Commoner
Posts: 35
Joined: Sun Sep 17, 2006 10:05 am

Post by dclamp »

how do i have it insert to where i want it to?
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

in the url? Did you try what I said?
User avatar
dclamp
Forum Commoner
Posts: 35
Joined: Sun Sep 17, 2006 10:05 am

Post by dclamp »

how do i have it display the code? i am very lost here...
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I misunderstood your question... use $_POST or $_GET depending on which method you use in your form IE method="post" then use $_POST
User avatar
dclamp
Forum Commoner
Posts: 35
Joined: Sun Sep 17, 2006 10:05 am

Post by dclamp »

ok. i am new to php. i dont know what you are saying. lol. i am sorry. if you could like explain it step by step :?:
User avatar
waradmin
Forum Contributor
Posts: 240
Joined: Fri Nov 04, 2005 2:57 pm

Post by waradmin »

ignore me for a min
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

dclamp wrote:ok. i am new to php. i dont know what you are saying. lol. i am sorry. if you could like explain it step by step :?:
did you read the page I posted a link to??
User avatar
dclamp
Forum Commoner
Posts: 35
Joined: Sun Sep 17, 2006 10:05 am

Post by dclamp »

I really dont understand them. I dont know what to look for. maybe i am makeing myself unlclear. Here is what i am looking to do:

The user visits the page, there is a textbox that the user types in their ID number. They click "Submit".

Then the form disappears and a textarea box apears with the following code and the ID that the typed in where it says "ID_HERE".

<a href="http://dclamp.homtek.net/invite.php?id=ID_HERE"><img src="url"></a>
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

On the first page add this:

Code: Select all

<form action="http://dclamp.homtek.net/invite.php" method="get" name="form1">
<input type="text" name="id">
<input type="button" onclick="document.form1.submit()">
</form>
In invite.php add this:

Code: Select all

<?php
  if(isset($_GET['id'])) {

    echo '<textarea><a href="http://dclamp.homtek.net/invite.php?id='.$_GET['id'].'"><img src="http://rapidfriends.com/images/logorf.jpg" alt="Promote RapidFriends Networking"></a> </textarea>';
  }
?>
Post Reply