473,396 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Echo after delete

142 100+
Hi,

Once I pressed submit to delete I want to echo, "record deleted".

It is not displaying now, can someone tell me why....It code it at the bottom.

Thanks

[PHP]

<?PHP
header( "cache-control: no-cache, must-revalidtae" );
header( "Pragme: no-cache" );
?>

<form action="<?php echo( $self ); ?>" method="post">
<select name="table">
<option value="a" selected="selected">A</option>
<option value="b">B</option>
<option value="c">C</option>
<option value="d">D</option>
<option value="e">E</option>
<option value="f">F</option>
<option value="g">G</option>
<option value="h">H</option>
<option value="i">I</option>
<option value="j">J</option>
<option value="k">K</option>
<option value="l">L</option>
<option value="m">M</option>
<option value="n">N</option>
<option value="o">O</option>
<option value="p">P</option>
<option value="q">Q</option>
<option value="r">R</option>
<option value="s">S</option>
<option value="t">T</option>
<option value="v">V</option>
<option value="w">W</option>
<option value="x">X</option>
<option value="y">Y</option>
<option value="z">Z</option>

</select>

<label></label>
<label>
<input name="biz" type="text" id="biz">
</label>
<br>
<input type="submit" value="submit">
</form>
<?php
$biz = $_POST['biz'];
$self = $_SERVER['PHP_SELF'];
$table = $_POST['table'];
$self = $_SERVER['PHP_SELF'];
$submit = $_POST['submit'];


$con = mysql_connect("localhost", "******", "*****");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}mysql_select_db("*********", $con);

mysql_query("DELETE FROM $table WHERE business_name='$biz'");mysql_close($con);

if (isset($_POST['submit'])) {
$submit = "Record Deleted";

echo ("$submit");
}

?>

[/PHP]
Apr 23 '07 #1
2 1748
mwasif
802 Expert 512MB
Change the submit button to
<input type="submit" value="submit" name="submit">

OR

[PHP]<?php
// page is submitted
if (isset($_POST['submit'])) {
{
$biz = $_POST['biz'];
$self = $_SERVER['PHP_SELF'];
$table = $_POST['table'];
$self = $_SERVER['PHP_SELF'];
$submit = $_POST['submit']; // Why you are doing this?


$con = mysql_connect("localhost", "******", "*****");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("*********", $con);

if(mysql_query("DELETE FROM $table WHERE business_name='$biz'"))
{
$submit = "Record Deleted";
echo ("$submit");
}

mysql_close($con);
}
?>[/PHP]

consider using mysql_real_escape_string() (www.php.net/mysql_real_escape_string) like

[PHP]$biz = mysql_real_escape_string($_POST['biz']);[/PHP]
Apr 23 '07 #2
webandwe
142 100+
thanks, it is working now
Apr 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: lawrence | last post by:
Right now, over at www.monkeyclaus.org, the following script is getting to the 9th run through and dying after the line: echo "..."; You'll admit that is a strange place to die. I've hit...
6
by: Marco | last post by:
I have a couple pages that have tables, whats best use echo to produce the full table with the variables or is it best to just make the table in plain html and use <?php echo ('$va'l); ?> when i...
9
by: Domestos | last post by:
Here an unusual one... Say i am writing a few lines of code in php script as so... <?php echo '<table>'; echo '<tr>'; echo '<td> blah blah </td>'; echo '</tr>'; echo '</table>';
9
by: windandwaves | last post by:
Hi Folk My question is: echo all the time vs echo at the end - what is faster Let me explain I used to write pages like this: echo "<head> ";
2
by: Swann | last post by:
Hello, I have a form linked to a table with a button that deletes the currently selected record with a VBA sub. When I perform the delete query, the data in the fields are replaced with #DELETE,...
4
by: rawky1976 | last post by:
Hi, I have a hyperlink which goes to the page below and passes the PK_ID from a query into 'userid'. From this we query the DB and then echo a table with a form; only the textboxes are already...
21
by: paitoon | last post by:
Hello there, The fuction $_SERVER; is nice to use but it so complicate for me... In my site to try to use this to add the information to database..but it work not correct because it will...
1
by: areya | last post by:
This is a SQLPLUS question. How do I display what is being executed. In other words, in the listing below what command do I need to use to see if commit will be executed. As an example, can I say:...
32
by: Request-1 | last post by:
hi folks, html coder here, new and terrified * of php!! aaaaaa! i'm trying to bury a JS script to rotate a photo, in a page i converted from html to php. the conversion went well, it was to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.