logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Video Tutorials
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 02-17-2009, 04:58 PM   #1
songboy
 
Join Date: Jan 2009
Posts: 115
Default Beginners PHP Video 9

Could someone explain why the entries in the form fields disappear as the entries appear in the data table. I'm using the tutorial as a starter model for my own website login and when I try it out, the entered data stays in the fields.
(PS I'm sending the post data to another program just to try things out.)
songboy is offline   Reply With Quote
Old 02-17-2009, 06:46 PM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

post your code
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 02-17-2009, 08:05 PM   #3
songboy
 
Join Date: Jan 2009
Posts: 115
Default my code

<?php
//call into play the connection program//
include("connection.php");

//the input data you get from the user eg his email address, is turned into boxed data (or variables)//
$first_name = $_POST['first_name'];
$second_name = $_POST['second_name'];
$email_address = $_POST['email_address'];
$confirm_email_address = $_POST['confirm_email_address'];
$password = $_POST['password'];
$submit = $_POST['submit'];

//If the form fields are filled, put the response data into the database//
if($first_name && $second_name && $email_address && $password && $submit)
{
$query = sprintf("INSERT into new_visitor_login (first_name, second_name, email_address, password)
values ('$first_name', '$second_name', '$email_address', '$password')");
mysqli_query($cxn,$query) or die (mysqli_error($cxn));
}
//If any of the fields are empty and the submit is pressed echo a message//
elseif ($submit)
{
echo "All fields need to be completed.";
}
?>
This is my code. It's a separate file ie it's not returning to the same page. The form action is pointed to the code above. It all works fine except:
1. on submit the form page goes (I have worked out that I will need to
include the page back again), the echoed message appears on the
new, blank page
2. the test entries stay in the form fields (they are there when you call
the page back - your fields empty on submit),
3. the data appears in SQL Manager (brilliant !) but you have to press the
refresh tick for it to appear (maybe that's normal)
Thanks - songboy

Last edited by songboy; 02-17-2009 at 08:19 PM..
songboy is offline   Reply With Quote
Old 02-17-2009, 10:45 PM   #4
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

1. dont understand this

2. if your using the browser back button then the data will redisplay

3.remember that your select statment has to come after the update
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Reply


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:28 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com