Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

xdp22 on "Form send to MySql problem"

$
0
0

Hello, i have problem with my code to send form values into Mysql database.

I used wordpress plugins to put php and html code in page, then my codes are simple html form and php mysql code to connect with database and send query.

I think everything should work but it doesn't

Searched many solutions on internet but i can't get it work.
It just don't sending values to database, like the form doesn't work

Someone can help me?

Here is my PHP code

if(isset($_POST['submit']))
{
~~ DB INFORMATIONS~~

$nick = $_POST['nick'];
$team = $_POST['team'];
$mail = $_POST['mail'];
$region = $_POST['region'];
$nick_query = mysql_query("SELECT <code>nick</code> FROM <code>zapisy</code> WHERE <code>nick</code> = '$nick'") or die("Error: Sprobuj ponownie pozniej.");
   $count_nick = mysql_num_rows($nick_query);
$team_query = mysql_query("SELECT <code>team</code> FROM <code>zapisy</code> WHERE <code>team</code> = '$team'") or die("Error: Sprobuj ponownie pozniej.");
   $count_team = mysql_num_rows($team_query);
    $mail_query = mysql_query("SELECT <code>mail</code> FROM <code>zapisy</code> WHERE <code>mail</code> = '$mail'") or die("Error: Sprobuj ponownie pozniej.");
   $count_mail = mysql_num_rows($mail_query);

    if($count_nick > 0){
   echo 'Lider o takim nicku zapisa? ju? inn? dru?yn?';
    }elseif($count_mail > 0){
   echo 'Ten adres e-mail zosta? ju? u?yty do zapisu innej dru?yny';
   }elseif($count_team > 0){
   echo 'Dru?yna o takiej nazwie zosta?a ju? zapisana';
}else{
$zap = mysql_query("INSERT INTO <code>zapisy</code> (<code>nick</code>, <code>team</code>, <code>mail</code>, <code>region</code>) VALUES ('".$nick."', '".$team."', '".$mail."', '".$region."')");
}
}

HTML form code

<html>
<center>
    <form method="post" action="">
        Nick Lidera: <input name="nick" ID="nick" type="text"/>
        Nazwa drużyny: <input name"team" id="team" type="text"/>
        Adres E-mail(potrzebny do potwierdzenia udziału): <input name="mail" id="mail" type="text" />
        <select name="region[]" size="3" multiple>
	<option value="euw">1</option>
	<option value="eune">2</option>
	<option value="na">3</option>
	</select>
        <input type = "submit" value = "Submit"/>

    </form>
</center>
</html>

[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]


Viewing all articles
Browse latest Browse all 8245

Trending Articles