TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 04-10-2005, 12:58 AM   #1 (permalink)
The Wanderer
 
Join Date: Apr 2005
Location: Missouri, USA
Posts: 15
Thanks: 0
William is on a distinguished road
Default Form Processing

Someone recently posted to make a Form Processing script so people would know how to use forms with there scripts.

Quote:
Originally Posted by Danny Needs Help
Form Processing/Mailing would be a good first tutorial :).
Well here you go. First of all you need to know a little HTML so you know how to make forms. Then you make you form. For instance:

<html>
<head>
<title>Form Processor</title>
</head>
<body>

FORM HTML
Code:
<form action='something.php' method='post'>

<table cellpadding='0' cellspacing='0'>
	<tr>
		<td>
			<input type='text' name='VARIABLE_NAME' />
		</td>
	</tr>
	<tr>
		<td>
			<input type='submit' value='Process Data' />
		</td>
	</tr>
</table>

</form>

</body>
</html>
something.php
PHP Code:
<?php

echo $_POST['VARIABLE_NAME'];

?>
There... Now you are wondering how does that work. Whatever you make the name of the form the value makes the variable set on the next page. I added $_POST[''] around the variable so it knew to get the data from a method on named post. in <form we added method='post' you can make it method='get' also. Which basically means you put $_GET[''], the difference is post is run hidden. Get puts all the variables in the url and gets the data from the url in other words for sites that have something.php?id=61102 to get the id you use $_GET['id'] it is just 2 different ways of putting the data to the next page. Most people like the post way to hide data like passwords but others like to show it to make there URL look cooler plus so people can send the url to a friend and it will automatically process the data. For instance if you made a script that calculated just using url you could make a file like:

calculator.php
PHP Code:
<?php

echo $_GET['data'];

?>
Then all you have to do is go to calculator.php and in url put: calculator.php?data=5+5-8*1/8 which will output: 0.25 on the page.
now to go back to the old method "post" you could make a form and on the page make a text box called "to" and someone put there eMail address there.Now on the page that the form sends the data to
just make it print $to and it will print what they typed. Now if you wanted to use what I said on the mail() tutorial you could do something like make a html
form then make the names... to, subject, body. then on the next page type: mail($to, $subject, $body, "From: My Feedback"); and you just made a feedback. Now
your probably wondering how does the html file know where to send the data. Well just change action='' in the <form> to the address of the PHP file and away you go.
Good luck!

Last edited by William : 04-11-2005 at 01:59 AM.
Send a message via AIM to William Send a message via MSN to William
William is offline  
Reply With Quote
Old 04-10-2005, 01:38 AM   #2 (permalink)
The Contributor
 
Join Date: Mar 2005
Posts: 81
Thanks: 0
AlEast is on a distinguished road
Default

Can you update with register globals off since this will be the desired setting in the php.ini
__________________
NEWEDGE Services, Inc. - Developers of ClientExec
AlEast is offline  
Reply With Quote
Old 04-10-2005, 02:00 AM   #3 (permalink)
The Acquainted
 
Join Date: Mar 2005
Posts: 177
Thanks: 0
CreativeLogic is on a distinguished road
Default

There will need to be a few changes to this also. Once the tutorial section is updated we'll move it to a new area. Update it as AlEasy suggested and once the tutorial code is completed I'll either move it there or you can.
CreativeLogic is offline  
Reply With Quote
Old 04-11-2005, 02:00 AM   #4 (permalink)
The Wanderer
 
Join Date: Apr 2005
Location: Missouri, USA
Posts: 15
Thanks: 0
William is on a distinguished road
Default

I just fixed the tutorial, Thanks for finding the bug. I do that for all my codes but I didn't wanna make it anymore harder for people that are just starting out. I forgot about the problem if register globals were off.
Send a message via AIM to William Send a message via MSN to William
William is offline  
Reply With Quote
Old 04-11-2005, 02:07 AM   #5 (permalink)
The Acquainted
 
Join Date: Mar 2005
Posts: 177
Thanks: 0
CreativeLogic is on a distinguished road
Default

Either way, thanks for fixing it!
CreativeLogic is offline  
Reply With Quote
Old 04-11-2005, 02:10 AM   #6 (permalink)
The Wanderer
 
Join Date: Apr 2005
Location: Missouri, USA
Posts: 15
Thanks: 0
William is on a distinguished road
Default

No problem.
Send a message via AIM to William Send a message via MSN to William
William is offline  
Reply With Quote
Old 04-15-2005, 12:49 AM   #7 (permalink)
The Wanderer
 
Join Date: Apr 2005
Posts: 18
Thanks: 0
Veolus is on a distinguished road
Default

That's exactly what i have been looking for, the past few days.

Thanks for sharing this tutorial with us :)
__________________
Please Join >> http://www.streetballforum.com :o
Veolus is offline  
Reply With Quote
Old 04-16-2005, 01:34 PM   #8 (permalink)
The Wanderer
 
Join Date: Apr 2005
Posts: 7
Thanks: 0
edmarriner is on a distinguished road
Default

very nice :D
keep them cooming !!!!!

ed
edmarriner is offline  
Reply With Quote
Old 04-17-2005, 03:24 PM   #9 (permalink)
The Wanderer
 
Join Date: Apr 2005
Posts: 14
Thanks: 0
alegend is on a distinguished road
Default

Thanks!
I been looking for something like this, since I kept getting errors when I tried writing one. Hope to see more.
alegend is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form validation help 3gg1 General 0 10-06-2006 03:16 PM
Submission form issues Ogden2k Absolute Beginners 5 06-01-2005 11:55 PM
Form Processing Help Veolus Absolute Beginners 3 04-16-2005 04:16 AM


All times are GMT. The time now is 07:26 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design