Reply to Re: How do I execute sql with a submit button?

Your name:

Reply:


Posted by Hilarion on 11/15/05 18:37

> echo"<form name=\"reset_database\" method=\"post\" action=\"<? $PHP_SELF
> ?>\">

The line above will give wrong results (or causes parse error). Replace it
with something like:

echo '<form name="reset_database" method="post" action="';
echo htmlspecialchars( $_SERVER['PHP_SELF'] );
echo '">';
// next lines should be also echoed

or something like:

?>
<form name="reset_database" method="post"
action="<?php echo htmlspecialchars( $_SERVER['PHP_SELF'] ); ?>">
<!-- next lines -->
<?php
// PHP code here

> <center><input type=\"submit\" name=\"enter_data\" value=\"Reset database
> after printing\"></center>
> </form>";
> if ($enter_data) {
> $sql = "UPDATE cubecartstore_order_inv SET order_from_supplier = '0'";
> }


You should also place this at the very start of your script:
error_reporting( E_ALL );

and use all database error reporting functions in all possible places.

The code seems to be incomplete. You did not use any database functions
nor did you use your $sql variable in any way. Post the complete
script or better strip your script to the form which is complete
(should perform the action you want) but still does not behave the
way you want it to (you should test it) and post the stripped script.


Hilarion

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация