GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 10-Mar-2007, 11:51
pembomassive pembomassive is offline
New Member
 
Join Date: Mar 2007
Posts: 11
pembomassive is on a distinguished road

button from code to db


Hi I have a guest area where I want people to sign up on a page and have completed the fundamentals, but not the button. I want once the button is clicked on it to take the personal information into the database from the page? Any ideas
  #2  
Old 14-Mar-2007, 05:09
pembomassive pembomassive is offline
New Member
 
Join Date: Mar 2007
Posts: 11
pembomassive is on a distinguished road

Re: button from code to db


?????

So if I have a form completed say if you were signing up as a member how would this information be taken into the db and submitt
  #3  
Old 14-Mar-2007, 06:02
admin's Avatar
admin admin is offline
Administrator
 
Join Date: Sep 2002
Posts: 733
admin will become famous soon enough

Re: button from code to db


When the form is submitted (e.g. via the post method), the target script will receive the user submitted data inside the $_POST variable/array.

To understand how this works, look at the sample documents below...

For example, the web page with the form is test_form.htm:

HTML Code:
<html> <head> <title>The form</title> </head> <body> <form name="formTest" id="formTest" method="post" action="test_save.php"> <p>Username: <input type="text" name="inputUsername" id="inputUsername" value="" /></p> <p>Email: <input type="text" name="inputEmail" id="inputEmail" value="" /></p> <p><input type="submit" name="inputSave" id="inputSave" value="Save" /></p> </form> </body> </html>

Looking at the form, you will see that all the data is destined for test_save.php. When the user fills in her data and submits the form, the data she submitted will be passed to this script.

The test_save.php script can look something like this:

PHP Code:

<?php


    if( $_POST )
    {
        echo '<pre>';
        print_r( $_POST );
        die( '</pre>' );

    }
    else
    {
        die( "<p>Sorry, please fill-in your data in this <a href='test_form.htm'>form</a>.</p>" );
    }
?>


The $_POST array would look like this:

$_POST['inputUsername'] = 'Data submitted by the user appears here';
$_POST['inputEmail'] = 'Data submitted by the user appears here';
$_POST['inputSave'] = 'Save';


Once you figure out how to handle user submitted data from within a PHP script, you can ask us about getting it all into a MySQL database table.

I hope I have not misunderstood your question.
__________________
Custom BB codes you can use here:
[HTML] | [C++] | [CSS] | [JAVA] | [PY] | [VB]
  #4  
Old 22-Mar-2007, 07:39
pembomassive pembomassive is offline
New Member
 
Join Date: Mar 2007
Posts: 11
pembomassive is on a distinguished road

Re: button from code to db


hi the first part i adapted and appears to work the second is not, think am prob doing wrong can u take a look at this for me please?


<html>
<head>

<body bgcolor="#99CCCC">


<link rel="stylesheet" type="text/css"
href="cssformat.php" />

<h2>Please enter your personal details</h2>
<hr>

<form name="formTest" id="guest" method="post" action="update.php">
<p>First name: <input type="text" name="inputfirstName" id="inputUsername" value="" /></p>
<p>Last name: <input type="text" name="inputlastName" id="inputEmail" value="" /></p>
<p>Gender: <select>
<option>Male</option>
<option>Female</option>
</select></p>
<p>Country: <select>
<option>Australia</option>
<option>Canada</option>
<option>France</option>
<option>India</option>
<option>New Zealand</option>
<option>United Kingdom</option>
<option>United Stated</option>
<option>Other</option>
</select></P>
<p>County: <input type="text" name="inputcounty" id="inputUsername" value="" /></p>
<p>Email: <input type="text" name="inputemail" id="inputUsername" value="" /></p>
<p><input type="submit" name="inputSave" id="inputSave" value="Save" /></p>
</form>

</body>
</html>#

--------------------------------------------------------------------------part two

<?php

if($_POST)
{
echo'<pre>';
print_r( $_POST );
die( '</pre>' );

}
else
{
die( "<p>Sorry, please fill-in your data in this <a href='test_form.htm'>form</a>.</p>" );
}

$_POST['fistName'] = 'Data submitted by user appears here';
$_POST['lastName'] = 'Data submitted by user appears here';
$_POST['gender'] = 'gender selction appears here';
$_POST['country'] = 'country selection appears here';
$_POST['county'] = 'Data submitted by user appears here';
$_POST['email'] = 'Data submitted by user appears here';

?>
  #5  
Old 26-Mar-2007, 05:27
pembomassive pembomassive is offline
New Member
 
Join Date: Mar 2007
Posts: 11
pembomassive is on a distinguished road

Re: button from code to db


???????????????/
 
 

Recent GIDBlogToyota - 2008 July Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

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 Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to sort random access file? wmmccoy0910 C Programming Language 12 04-Sep-2006 03:40
Here it is again! 35% - 40% off For Life! my-e-space Web Hosting Advertisements & Offers 0 20-Apr-2006 14:48
User defined headers davis Miscellaneous Programming Forum 6 16-Feb-2006 18:40
Problem with int mixed with char,... leitz CPP / C++ Forum 17 07-Dec-2004 20:56
Help! Some basal questions about MFC xutingnjupt MS Visual C++ / MFC Forum 1 05-Dec-2004 03:38

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:35.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.