Viewing form results ???????

This is a discussion on "Viewing form results ???????" within the PHP Forum section. This forum, and the thread "Viewing form results ??????? are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 25th, 2006, 22:18
New Member
Join Date: Apr 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Viewing form results ???????

I am very new to PHP and am learning to update my knowledge. I cannot see the answer to my problem anywhere so am beginning to think i am really thick. I have created a form on a website and have the coresponding PHP file to go with it. When the form is submitted i receive the reply that I should from PHP. But how the hell do i view the results/data from the form. I have the relevant $_POST parts in and have even managed to send the results to my e-mail. but this is not good for checkboxes or radio functions. When someone fills in my form and presses submit, what do i do to see what they have put.....step by step please as i am totally confused by this one aspect.

Thanks muchly


Last edited by cat101; Apr 25th, 2006 at 22:59.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Apr 25th, 2006, 23:10
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Viewing form results ???????

You want to see what exactly? The result of your data?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Apr 25th, 2006, 23:29
New Member
Join Date: Apr 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Viewing form results ???????

Exactly....i guess this must sound stupid but i don't know what to open, or click or upload???

e.g if some one puts their name in a field and checks a checkbox and then presses submit, how will i know they have pressed submit and where do i get their submission results from???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Apr 25th, 2006, 23:57
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Viewing form results ???????

Well basically this is how it works.
Each input has a name and a value, sometimes that value can be set by you (example a checkbox or a hidden input field). But most of the time the value is something the user inputs (such as a text box)

Ok now lets do our form named form.php
Code: Select all
<form method="post" action="form.php">
Favourite colour?<input type="text" name="fav_colour" /><br />
Favourite food?<input type="text" name="fav_food" /><br />
Do you like dogs?<input type="checkbox" name="likedogs" value="yes" /><br />
<input type="submit" name="Submit" value="submit" />
</form>
So theres our form with 4 form inputs. As you can see the action of the form is itself, this will be explained.

Open up your form for editing and above your form code type:
PHP: Select all

<?php
if (isset($_POST['submit'])) {
$colour $_POST['fav_colour'];
$food $_POST['fav_food'];
$likedogs $_POST['likedogs'];

print 
"Your favourite colour is <b>$colour</b>. Your favourite food is <b>$food</b>.<br />";
if (
$likedogs == NULL) {
}
else {
print 
"And you do like dogs!";
}
}
else {
?>
<form method="post" action="form.php">
 Favourite colour?<input type="text" name="fav_colour"><br />
 Favourite food?<input type="text" name="fav_food"><br />
 Do you like dogs?<input type="checkbox" name="likedogs" value="yes"><br />
 <input type="submit" name="Submit" value="submit">
 </form>
<?php 
}
?>
Basically the first thing php does it check if submit has been clicked. If so it handles the form information by retrieving the values that the user has entered.
I put each of these values as a variable so i can use them however i wish later on.
I then print the variables (as these variables hold our information) into a small statement.

I then see if the tickbox has been ticked or not (remember the value of the checkbox is yes. If it isnt ticked there is no value.
So i ask if the value is equal to NULL do nothing. Else print the statement.
The last else statement is the second part of the first ever if statement asking if the form has been submitted. It hasnt so i then show the form.

This is just an example, you can do whatever you want with the information.
Hope this helps you.

Last edited by sypher; Apr 26th, 2006 at 00:04.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
viewing, form, results

Thread Tools

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

BB 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
Publicly viewable form results? wealthy199 Starting Out 5 Sep 27th, 2007 14:59
Getting form results to email as an .html griffster122 Starting Out 1 May 29th, 2007 01:44
Problem with results of form Otter PHP Forum 2 Nov 7th, 2006 13:35
PHP form results $PHP_self is blank jamina1 PHP Forum 17 Sep 23rd, 2005 16:13
Submitting Web form results to a database theproman23 Databases 2 Jun 30th, 2005 13:21


All times are GMT. The time now is 16:32.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42