Posted: Wed Oct 04, 2006 1:11 pm
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
<?php
include "m_config.php";
echo "<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form name=\"decision\" method=\"post\" action=\"http://127.0.0.1/web/file.php\">
<input type=\"hidden\" name=\"action\" value=\"add\">
<input name=\"name\" type=\"text\">
<input name=\"lname\" type=\"text\">
<br />
<label title=\"choice\" >
yes <input name=\"choice\" type=\"radio\" value=\"yes\" checked>
No <input name=\"choice\" type=\"radio\" value=\"no\"></label>
<input type=\"submit\" value=\"submit\" />
</form> <br /> $result
".read()."
</body>
</html>";Code: Select all
<?php
$hostname = "127.0.0.1";
$username = "root";
$password = "dfdfd";
$database = "something";
$table_prefix = "m_";
mysql_connect($hostname, $username, $password) or die("Could not connect to MySQL");
mysql_select_db($database) or die("Could not connect to MySQL"); ?>That's in another script?kakapeepee wrote:if(!$query)
{
$result = "An error has occured";
}
else
{
$result = "Thanks...";
}
Then tell me where there is a $result = "something" inkakapeepee wrote:i thought $result = "something" will display something when i used it in some html part:S
kakapeepee wrote:Code: Select all
<?php include "m_config.php"; echo "<html> <head> <title>Untitled Document</title> </head> <body> <form name="decision" method="post" action="http://127.0.0.1/web/file.php"> <input type="hidden" name="action" value="add"> <input name="name" type="text"> <input name="lname" type="text"> <br /> <label title="choice" > yes <input name="choice" type="radio" value="yes" checked> No <input name="choice" type="radio" value="no"></label> <input type="submit" value="submit" /> </form> <br /> $result ".read()." </body> </html>";
Code: Select all
if(!$query)
{
$result = "An error has occured";
}
else
{
$result = "Thanks...";
}Code: Select all
</form> <br /> $result
".read()."
</body>
</html>";Where? I don't see it. Neither inkakapeepee wrote:when the query is executed
there is an if statement
Code: Select all
if(!$query) { $result = "An error has occured"; } else { $result = "Thanks..."; }
nor inkakapeepee wrote:Code: Select all
<?php include "m_config.php"; echo "<html> <head> <title>Untitled Document</title> </head> <body> <form name="decision" method="post" action="http://127.0.0.1/web/file.php"> <input type="hidden" name="action" value="add"> <input name="name" type="text"> <input name="lname" type="text"> <br /> <label title="choice" > yes <input name="choice" type="radio" value="yes" checked> No <input name="choice" type="radio" value="no"></label> <input type="submit" value="submit" /> </form> <br /> $result ".read()." </body> </html>";
Tell me the filename and line number wherekakapeepee wrote:Code: Select all
<?php $hostname = "127.0.0.1"; $username = "root"; $password = "dfdfd"; $database = "something"; $table_prefix = "m_"; mysql_connect($hostname, $username, $password) or die("Could not connect to MySQL"); mysql_select_db($database) or die("Could not connect to MySQL"); ?>
starts.kakapeepee wrote:Code: Select all
if(!$query) { $result = "An error has occured"; } else { $result = "Thanks..."; }
Code: Select all
<?php
include "m_config.php";
echo "<html>
<head>
<title>Untitled Document</title>
</head>
<body>
<form name=\"decision\" method=\"post\" action=\"http://127.0.0.1/web/file.php\">
<input type=\"hidden\" name=\"action\" value=\"add\">
<input name=\"name\" type=\"text\">
<input name=\"lname\" type=\"text\">
<br />
<label title=\"choice\" >
yes <input name=\"choice\" type=\"radio\" value=\"yes\" checked>
No <input name=\"choice\" type=\"radio\" value=\"no\"></label>
<input type=\"submit\" value=\"submit\" />
</form> <br /> $result
".read()."
</body>
</html>";
if(isset($_POST['action']) && $_POST['action'] == "add")
{
$name = $_POST['name'];
$lname = $_POST['lname'];
$choice = $_POST['choice'];
$date = time();
$ip = GetHostByName($_SERVER['REMOTE_ADDR']);
if(!$name || !$lname)
{
$result = "Please fill all the required fields";
}
else
{
$query = mysql_query("insert into m_record (name,lname,yesno,date,ip) values('$name','$lname','$choice','$date', '$ip')");
if(!$query)
{
$result = "An error has occured";
}
else
{
$result = "Thanks...";
}
}
}
function read()
{
global $total;
$total = 0;
$query = mysql_query("select * FROM m_record where yesno='yes'");
while($array = mysql_fetch_array($query))
{
$total += 1;
}
return $total;
}
?>Code: Select all
<?php
$hostname = "127.0.0.1";
$username = "zaher";
$password = "okk";
$database = "marriage";
$table_prefix = "m_";
mysql_connect($hostname, $username, $password) or die("Could not connect to MySQL");
mysql_select_db($database) or die("Could not connect to MySQL"); ?>