Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]Code: Select all
<html>
<body>
<html>
<head>
<form action="lastform.php" method="post">
<h3> REGISTRATION DETAILS</h3>
<table>
<tr><td>Name:</td><td>
<input type="text" name="name1"></td></tr>
<tr><td>Email:</td><td>
<input type="text" name="e-mail1" size="30"></td></tr>
<tr><td>Address:</td><td>
<input type="text" name="address1" size="30"></td></tr>
<tr><td>ph Number:</td><td>
<input type="text" name="Ph_number" size="30"></td></tr>
</table>
</br>
<input type="submit" value="continue" name="submit">
</form>
</body>
</html>
//second form
<?php
$as=$_POST['name1'];
$as1=$_POST['e-mail1'];
$as2=$_POST['address1'];
$as3=$_POST['Ph_number'];
?>
<?php
$user_name = "root";
$password = "";
$database = "aditya";
$server = "127.0.0.1";
$db_handle = mysql_connect($server,$user_name,$password);
$db_found = mysql_select_db($database, $db_handle);
if($db_found)
{
$result=mysql_query("INSERT INTO details(name,e-mail,address,Phnumber) VALUES('$as','$as1','$as2','$as3')");
mysql_close($db_handle);
print "Records added to the database";
}
else
{
print "Database NOT Found ";
mysql_close($db_handle);
}
?>
<html>
<head>
<body>
<form action="view.php" method="post">
<input type="submit" value="VIEW RECORDS" name="submit">
</body>
</head>
</html>
// third from
<?php
$user_name = "root";
$password = "";
$database = "aditya";
$server = "127.0.0.1";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found) {
$SQL = "SELECT * FROM details";
$result = mysql_query($SQL);
while ($db_field = mysql_fetch_assoc($result)) {
print $db_field['name'] . "<BR>";
print $db_field['e-mail'] . "<BR>";
print $db_field['address'] . "<BR>";
print $db_field['Phnumber'] . "<BR>";
}
mysql_close($db_handle);
}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}
?>my problem is i can send any values from form 1 to database. please how ? and very this code.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]2.[/b] Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.[/quote]