PDA

View Full Version : I am going crazy.


gigiloumill
07-10-2009, 02:13 AM
I can't figure out for my life why when I send a form to the db, the info does not arrive there. I have the testing server configured, phpmyadmin, ok, the testing form works. I can send info, the injecting script fires up, the db is configured, the recordsets are set but the info does not arrive at the db. What am I doing wrong? Somebody please?

edbr
07-10-2009, 02:23 AM
post your code

gigiloumill
07-10-2009, 11:16 AM
<?php
$host="localhost";
$user="root";
$pass="password";
mysql_connect($host,$user,$pass);

$name= $_POST['fname'].$_POST['email'] ;
$email=$_POST['lname'];

if($submit)
{
mysql_select_db("mydb");
$result=MYSQL_QUERY("INSERT INTO new (name,email)" . "VALUES ('$name','$email')");
print "$name was added";
}
?>

domedia
07-10-2009, 03:24 PM
Moved to PHP. Should get some more responses here. Remember to use descriptive thread titles.

gigiloumill
07-10-2009, 06:13 PM
I just noticed, I assigned the name of the db but I did not assign the table name. would that be the reason text is not recording?

domedia
07-10-2009, 06:47 PM
I just noticed, I assigned the name of the db but I did not assign the table name. would that be the reason text is not recording?
In all seriousness, do you think it's going to guess the tablename? :)

gigiloumill
07-10-2009, 07:45 PM
I don't think so. Can you show me how to include the tble name and an e-mail to send at the same time? thanks a million.

gigiloumill
07-11-2009, 12:49 AM
oK, i REALLY do not know what the hell is wrong with this form. After sending I do not get an error. the insert is pointed to the database and the table. But, I still do not know why it will not record. Does anyone else have a suggestion? Thanks

edbr
07-11-2009, 04:33 AM
this is a double posrt btw you have said table name is named new in your insert statement. is this correct?

domedia
07-11-2009, 11:49 AM
If this is a double post is it practical to merge them?
If not let's close one thread.
gigiloumill, one topic is one thread please.

gigiloumill
07-11-2009, 12:44 PM
this is a double posrt btw you have said table name is named new in your insert statement. is this correct?

I replaced "new" with the right table name and still nothing. Is the table name part of the script correct? I've tried making a new table with a different name and still doesn't work.

bee80
07-11-2009, 02:10 PM
Your assigning the query to a variable but not doing anything with the $result variable.
Try taking the variable out like so:
<?php
$host="localhost";
$user="root";
$pass="password";
mysql_connect($host,$user,$pass);

$name= $_POST['fname'].$_POST['email'] ;
$email=$_POST['lname'];

if($submit)
{
mysql_select_db("mydb");
mysql_query("INSERT INTO tablename (name,email)" . "VALUES ('$name','$email')");
print "$name was added";
}
?>

Where is your submit variable being defined from? submit button or a hidden form field?

bee80
07-11-2009, 02:14 PM
id also have a closer look at your name and email variables if i were u

gigiloumill
07-11-2009, 09:40 PM
Your assigning the query to a variable but not doing anything with the $result variable.
Try taking the variable out like so:


Where is your submit variable being defined from? submit button or a hidden form field?

varaiable defined from "submit button"

gigiloumill
07-12-2009, 12:06 AM
O.K I am going on 3 days now and CANNOT find a solution for this. I am using WAMP5 server. Does anyone have a similar script I can use to see what I am doing wrong PLEASE? Thanks

gigiloumill
07-12-2009, 12:23 AM
This is all I get in the table:

~0 InnoDB latin1_swedish_ci 16.0 KiB (http://localhost/phpmyadmin/tbl_structure.php?db=mydb&token=de7e488ceebdc9a1a9ef8727dd4cc1ac&goto=db_structure.php&table=work#showusage)

bee80
07-12-2009, 08:28 AM
please post your form code too

are you defining: $submit = $_POST['submit'];

gigiloumill
07-13-2009, 12:09 AM
<form id="form1" name="form1" method="post" action="sendform.php">
<table width="345" border="0">
<tr>
<th width="93" scope="col">name</th>
<th width="242" scope="col"><input type="text" name="name" id="name" /></th>
</tr>
<tr>
<th scope="col">last name</th>
<th scope="col"><input type="text" name="lname" id="lname" /></th>
</tr>
<tr>
<th scope="col">email</th>
<th scope="col"><input type="text" name="email" id="email" /></th>
</tr>
<tr>
<th scope="col">&nbsp;</th>
<th scope="col"><input type="submit" name="submit" id="submit" value="Submit" /></th>
</tr>
</table>
</form>

gigiloumill
07-13-2009, 12:24 PM
Someone has to know something. This has to be the worst I had to encounter.

gigiloumill
07-13-2009, 01:08 PM
I'd like to thank everyone involved that try to help. I have found the solution. I rewrote the code. Thanks again.