Page 3 of 3

Posted: Wed Oct 04, 2006 3:06 pm
by Luke
poopoo kaka... you have to declare the $result variable and assign it a value before it will be useful in any way...

Code: Select all

<?php
include "m_config.php";
        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;
}
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>";
?>

Posted: Wed Oct 04, 2006 3:15 pm
by kakapeepee
then what to do !! im here asking ur help!! what should ido

Posted: Wed Oct 04, 2006 3:24 pm
by Luke
I could have sworn I just posted revised code...

Posted: Wed Oct 04, 2006 3:49 pm
by daedalus__
Wow.

First, you said that you know alot about PHP and only had one simple question. After you kept having trouble with your script, rather than saying thanks and politely requesting more help, you tell people to fix it?
kakapeepee wrote: that's the whole file, FIX IT
Rude.
kakapeepee wrote: then what to do !! im here asking ur help!! what should ido
I think that you should read the manual, adjust your attitude, and return here if you need more help.

P.S. TNSG just told you what to do.

Posted: Thu Oct 05, 2006 3:47 am
by kakapeepee
:)oh sorry guys if i seemed like that :$ it's just some personnal problems i have these days, and im like not being myself, so , sorry if i seemed rude.


and also regarding my previous post, i posted it when The Ninja Space Goat's post wasn't already there, so excuse me for it too.

and about my php knowledge, yes i repeat it, and say i know allot about php, but i really donno for some reason stuck today with some little problem.


i will check The Ninja Space Goat's code now :)

thx