Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.
All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!
Check mo ang mga lines na to
dapat pag tinatawag yan di babalik sa file na tumawag sa kanya. This was raise in order to prevent infinite loop or redirection.
base sa code mo. yong else statement, don't redirect. Just stay with the page. Then put ka nalang condition to display an error. Not redirecting kasi parang bumabalik cya sa file na to eh.
Sir try mo po palitan ng $_GET yung $_POST.
yung method po pala nung submission nung form? post o get?
method="post" po..
mron n po kc aq unang form n gnyan dn..eh working nmn po..
then copy paste q nlng po at edit..tpos aun..dont work..
eh naicp q po bka po s fieldname q..pro try q rn po GET method..thanks po..!
Aw, sa pagkakaalam ko po you must use $_GET function in order to retrieve the value from an assigned variable . Mamaya po pag uwi ko sa bahay kakalkalin ko yung mga lumang files ko.
AYUN..working na po..hehe..THANK YOU PO..
sorry po for late reply
Ay Sir 1 pa po problem q..ask q lng po if my alm kyo n mga fieldname n hnd tnatanggap ng mysql..
bale s form.php q i have 5 textfield in a <form action="code.php">
named: fname,lname,user,pass,type;
=========
in code.php:
include("../../../connection/connection.php");
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$user=$_POST['user'];
$pass=$_POST['pass'];
$type=$_POST['type'];
$sql="INSERT INTO tblaccount( fname,lname,user,pass ) VALUES ( '$fname','$lname','$user','$pass','$type' )";
$result=mysql_query($sql);
if($result)
{
echo "Success!";
//header("location:success_add.php");
}
else
{
echo "Failed!";
//header("location:error_add.php");
}
?>
============
then plgi po undefined index dw s fname,lname,user,pass,type. prang d nya po nffetch ung mga field q..
ano po kya problem jn? please help me po..
THANKS IN ADVANCE!
$sql="INSERT INTO tblaccount( fname,lname,user,pass ) VALUES ( '$fname','$lname','$user','$pass','$type' )";
ok na yung POST method ang ginamit mo, since supposedly dapat secured yung password field...
anyway, yung problem mo ay nandito
Code:$sql="INSERT INTO tblaccount( fname,lname,user,pass ) VALUES ( '$fname','$lname','$user','$pass','$type' )";
4 lang yung fields na ini-specify mo, pero 5 yung parameters / values na ipinapasa mo... ang kulang mo na field ay yung para sa type
AYUN..working na po..hehe..THANK YOU PO..
sorry po for late reply
Ay Sir 1 pa po problem q..ask q lng po if my alm kyo n mga fieldname n hnd tnatanggap ng mysql..
bale s form.php q i have 5 textfield in a <form action="code.php">
named: fname,lname,user,pass,type;
=========
in code.php:
include("../../../connection/connection.php");
$fname=$_POST['fname'];
$lname=$_POST['lname'];
$user=$_POST['user'];
$pass=$_POST['pass'];
$type=$_POST['type'];
$sql="INSERT INTO tblaccount( fname,lname,user,pass ) VALUES ( '$fname','$lname','$user','$pass','$type' )";
$result=mysql_query($sql);
if($result)
{
echo "Success!";
//header("location:success_add.php");
}
else
{
echo "Failed!";
//header("location:error_add.php");
}
?>
============
then plgi po undefined index dw s fname,lname,user,pass,type. prang d nya po nffetch ung mga field q..
ano po kya problem jn? please help me po..
THANKS IN ADVANCE!
<?php
include("../../../connection/connection.php");
/* Form submission validation.*/
if ($_POST["submit"]) /* Replace ["submit"] into the name of your submit button. */
{
/* Need condition above else you will recieve notices on this codes below */
/* Notice: undefine index fname ... */
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$user = $_POST["user"];
$pass = $_POST["pass"];
$type = $_POST["type"];
/* You can add also validations in here. */
if ($fname == "")
{
echo "First name is required.";
}
if ($lname == "")
{
echo "Last name is required.";
}
if ($user == "")
{
echo "Username is required.";
}
if ($pass == "")
{
echo "Password is required.";
}
if ($type == "")
{
echo "Account type is required.";
}
/* Some more variants of validations bla bla blah... */
/* Fixed mo yong field names na e.insert mo. 4vs5 */
$sql = "INSERT INTO tblaccount(fname, lname, user, pass, type) VALUES ('$fname', '$lname', '$user', '$pass', '$type')";
$result = mysql_query($sql);
if ($result)
{
echo "Success!";
}
else
{
echo "Failed!";
}
}
?>
di ko napansin, tama si sir. sa query pala yung mali. Pero sir, di po ba sa method ng submission ng form dapat post para hindi nya ipapass yung value tru url, pero kapag ire retrieve yung value dapat $_GET yung gagamitin?
Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.
However, because the variables are not displayed in the URL, it is not possible to bookmark the page.
When using method="get" in HTML forms, all variable names and values are displayed in the URL.
Note: This method should not be used when sending passwords or other sensitive information!
However, because the variables are displayed in the URL, it is possible to bookmark the page. This can be useful in some cases.
Note: The get method is not suitable for very large variable values. It should not be used with values exceeding 2000 characters.