Current time: 05-24-2012, 11:51 AM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with PHP Form?
09-18-2008, 01:40 AM
Post: #1
Help with PHP Form?
So, I was wondering if anyone knew any answer on how to do this.

I am a PHP newbie, so go easy on me Smile

Either way, I wanted to create a form so that when a user visits the URL http://example.com/form.php?variable=X

then, a form field assigned to the variable will be assigned the value 'X'.

PayPal uses this. I think it is like, HTTP requests, IDK.

Please help Angel

Need web hosting? Try MyBBWebHost!
#1 for Running MyBB Communities

-------
Biodegradable Sunscreen - Unblock Facebook
Visit this user's website Find all posts by this user
Quote this message in a reply
09-18-2008, 12:42 PM
Post: #2
RE: Help with PHP Form?
Something like an action?
With the get method?

"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - J.D Salinger
Find all posts by this user
Quote this message in a reply
09-23-2008, 09:07 PM (This post was last modified: 09-23-2008 09:07 PM by pepotiger.)
Post: #3
RE: Help with PHP Form?
try this
PHP Code:
if(isset($_GET['variable'])
{
$var urlencode($_GET['variable']);

than put the $var variable in the form

Official Arabic Translator.
Find all posts by this user
Quote this message in a reply
09-23-2008, 10:41 PM
Post: #4
RE: Help with PHP Form?
If you want some resources for learning php then check out this thread: http://community.mybboard.net/thread-37709.html

But as pepotiger said the main thing you will need is the $_GET['whatever'] function which gets values from the url get data (what you want). The isset bit is just checking that the variable actually exists so that it doesn't spit any errors later in the program if it is not assigned.

Need help? Have you seen this?
Find all posts by this user
Quote this message in a reply
09-23-2008, 11:55 PM
Post: #5
RE: Help with PHP Form?
(09-23-2008 09:07 PM)pepotiger Wrote:  try this
PHP Code:
if(isset($_GET['variable'])
{
$var urlencode($_GET['variable']);

than put the $var variable in the form

Should be urldecode since you're getting a value from the URL. Also you need to use htmlspecialchars before outputting it into the HTML form.

http://php.net/urldecode
http://php.net/htmlspecialchars

Dennis Tsang :: MyBB Developer
Follow me on Twitter: @dennistt
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication