Jump to content

PHP: no echo statements or data POSTed


buchberg

Recommended Posts

To anyone,

 

Apache 2.2.21/PHP5.3.5/MySQL 5.2.36.  The following code returns the below errors.  I am trying to get the POSTed values into MySQL.  There are no other errors.  It's like the code stopped at the ?> closing statement.  Why would the code not return the 'echo' statements? 

 

Any ideas?????  Much appreciated....Buchberg

 

Notice: Use of undefined constant id - assumed 'id' in C:\website\do_addrecord_auth_users.php on line 2

 

Notice: Undefined index: id in C:\website\do_addrecord_auth_users.php on line 2

 

<?
if ((!$_POST[id]) || (!$_POST[f_name]) || (!$_POST[l_name]) ||
(!$_POST[username]) || (!$_POST[password]) || (!$_POST[firm]) || (!$_POST[email])) {
("Location: /show_addrecord_auth_users.html");
exit;
}
$db_name="booster";
$table_name="auth_users";
$connection=mysql_connect("localhost", "username", "password") or die (mysql_error());
$db=mysql_select_db($db_name, $connection) or die (mysql_error());
$sql="INSERT INTO $table_name
(id, f_name, l_name, username, password, firm, email) VALUES
('$_POST[id]', '$_POST[f_name]', '$_POST[l_name]', '$_POST[username]', 
'$_POST[password]', '$_POST[firm]', '$_POST[email]')";
$result=mysql_query($sql, $connection) or die (mysql_error());
?>
<HTML>
<HEAD>
<TITLE>Add a record to Auth Users</TITLE>
</HEAD>
<BODY>
<H1>Adding a record to <? echo "$table_name"; ?></H1>
<TABLE CELLSPACING=3 CELLPADDING=3>
<TR>
<TD VALIGN=TOP>
<P>id<BR>
<? echo "$_POST[id]"; ?></P>
</TD>
<TD VALIGN=TOP>
<P>First Name<BR>
<? echo "$_POST[f_name]"; ?></P>
</TD>
<TD VALIGN=TOP>
<P>Last Name<BR>
<? echo "$_POST[l_name]"; ?></P>
</TD>
<TD VALIGN=TOP>
<P>Username<BR>
<? echo "$_POST[username]"; ?></P>
</TD>
<TD VALIGN=TOP>
<P>Password<BR>
<? echo "$_POST[password]"; ?></P>
</TD>
<TD VALIGN=TOP>
<P>Firm<BR>
<? echo "$_POST[firm]"; ?></P>
</TD>
<TD VALIGN=TOP>
<P>email<BR>
<? echo "$_POST[email]"; ?></P>
</TD>
<P><a href="show_addrecord_auth_users.html">Add Another</a></P>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>

 

Link to comment
https://forums.phpfreaks.com/topic/257422-php-no-echo-statements-or-data-posted/
Share on other sites

  • 6 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.