hello all , i need help at this:
[php] <?
//connection stuff
$conexao = mysql_connect(" localhost", "root", "12345")
or die ("error to db.");
$db = mysql_select_db ("mal")
or die ("error selecting db.");
// some regex
$subject = $_POST['text'] ;
$pattern = '/def/';
preg_match($pat tern, $subject, $matches);
$sql = "INSERT INTO tab1 (nome )
VALUES ('$matches') " ;
$sql = mysql_query($sq l)
or die ("there was a mistake");
?>
<form action="mal.php " method="post">
<label for="texto">Tex to: </label>
<textarea name="texto" id="text" rows="10" cols="30" />
</textarea><br />
<input type="submit" value="insert">
</form>
[/php]
Ok, lets imagine i put in the text box something like : abcdefg
and i just want : def to be returned to mysql
i dont know why but the only thing i get returned is : array lol
can anyone help?
[php] <?
//connection stuff
$conexao = mysql_connect(" localhost", "root", "12345")
or die ("error to db.");
$db = mysql_select_db ("mal")
or die ("error selecting db.");
// some regex
$subject = $_POST['text'] ;
$pattern = '/def/';
preg_match($pat tern, $subject, $matches);
$sql = "INSERT INTO tab1 (nome )
VALUES ('$matches') " ;
$sql = mysql_query($sq l)
or die ("there was a mistake");
?>
<form action="mal.php " method="post">
<label for="texto">Tex to: </label>
<textarea name="texto" id="text" rows="10" cols="30" />
</textarea><br />
<input type="submit" value="insert">
</form>
[/php]
Ok, lets imagine i put in the text box something like : abcdefg
and i just want : def to be returned to mysql
i dont know why but the only thing i get returned is : array lol
can anyone help?
Comment