Hi everyone,
I appreciate all of your help with me and the problems I have been
having. I'm new to PHP and MySQL and I'm having some problems getting
this script to work. I can't get this to work and I don't understand
why. I don't get an error or anything, it almost seems like the page
refreshes. I went to the phpmyadmin and the row is still in the
database. The $_GET parts work perfectly in another script and the SQL
statement works when I insert hard values in it. Any thoughts would be
greatly appreciated. Thanks in advance.
<form method="POST" action="<?php print $_SERVER['PHP_SELF']; ?>">
<table>
<tr><td colspan="2" align="center"> Yes <?php
input_radiochec k('radio','yes_ no', $defaults, 'yes'); ?No <?php
input_radiochec k('radio','yes_ no', $defaults, 'no'); ?>
</td></tr>
<tr><td colspan="2" align="center"> <?php input_submit('s ave','Add'); ?>
</td></tr>
</table>
<input type="hidden" name="_submit_c heck" value="1"/>
</form>
<?php
function process_form() {
// Access the global variable $db inside this function
global $db;
$isbn = $_GET['isbn'];
$artist_name = $_GET['artist_name'];
$album_title = $_GET['album_title'];
if ($_POST['yes_no'] == 'yes') {
$delete_sql = "DELETE FROM lounge WHERE isbn = $isbn AND artist_name =
\'$artist_name\ ' AND album_title = \'$album_title\ '";
// Delete the record
$db->query($delete_ sql);
print "The record was deleted";
} else {
print "The record was not deleted";
}
}
?>
I appreciate all of your help with me and the problems I have been
having. I'm new to PHP and MySQL and I'm having some problems getting
this script to work. I can't get this to work and I don't understand
why. I don't get an error or anything, it almost seems like the page
refreshes. I went to the phpmyadmin and the row is still in the
database. The $_GET parts work perfectly in another script and the SQL
statement works when I insert hard values in it. Any thoughts would be
greatly appreciated. Thanks in advance.
<form method="POST" action="<?php print $_SERVER['PHP_SELF']; ?>">
<table>
<tr><td colspan="2" align="center"> Yes <?php
input_radiochec k('radio','yes_ no', $defaults, 'yes'); ?No <?php
input_radiochec k('radio','yes_ no', $defaults, 'no'); ?>
</td></tr>
<tr><td colspan="2" align="center"> <?php input_submit('s ave','Add'); ?>
</td></tr>
</table>
<input type="hidden" name="_submit_c heck" value="1"/>
</form>
<?php
function process_form() {
// Access the global variable $db inside this function
global $db;
$isbn = $_GET['isbn'];
$artist_name = $_GET['artist_name'];
$album_title = $_GET['album_title'];
if ($_POST['yes_no'] == 'yes') {
$delete_sql = "DELETE FROM lounge WHERE isbn = $isbn AND artist_name =
\'$artist_name\ ' AND album_title = \'$album_title\ '";
// Delete the record
$db->query($delete_ sql);
print "The record was deleted";
} else {
print "The record was not deleted";
}
}
?>
Comment