Jump to content

This is probably easy....


Tibblez

Recommended Posts

Hi,

I'm not the most experienced coder so try to explain things fully. :)

 

Alright then. Here's my problem.  I've made a website for people to sign a petition.  Below is only the page that displays the signatures.  The form that submits things to the database, which is called visitordata, isn't posted here and unless you need it I won't post it.  I just want to make the buttons do what they say down at the bottom.  In the code it says "Help me here".  I need the buttons to actually delete the comment from the comment field in the table, which is called `comment`.  I also want the delete the entire entry and ban the IP of the user who posted the entry.

The way I'm banning IP's is putting the banned IP's into a database which is the second picture and then it checks the users IP and if it is in the database then the content won't show.

 

The `visitordata` table is shown here:

 

5a8338a2b0.jpg

 

The `banip` table is shown here:

 

80efdd6db9.jpg

 

Help will be greatly appreciated!

 



<?php

include "/home/studentc/public_html/connect.php";

$query = mysql_query("SELECT * FROM visitordata");

$resultnum = mysql_num_rows($query);

print "<strong><font size=6>$resultnum</font> Signature(s).</strong>";

?> 

</center>
<hr>
</td></tr><tr><td width="80%" valign="top" colspan="1">
<ol> 

<?php
include "/home/studentc/public_html/connect.php";

$getdata="SELECT * from visitordata order by entryID desc";

$getdata2=mysql_query($getdata) or die("Could not get data");

while($getdata3=mysql_fetch_array($getdata2)){

print "<li>";

print "<font color=blue>";

$getdata3[name]=strip_tags($getdata3[name]);

$getdata3[comment]=strip_tags($getdata3[comment]);


$getdata3[lastname]=strip_tags($getdata3[lastname]);

$getdata3[status]=strip_tags($getdata3[status]);

print "<strong>Name:</strong> $getdata3[name] $getdata3[lastname]<br>";

print "<strong>Status:</strong> $getdata3[status]<br>";

print "<strong>Comment: </strong>";

print "$getdata3[comment]<br>";

print "</font>";

print "<hr>";

print "<P ALIGN=RIGHT><B>For above entry</B><BR>[Delete entry]<br>[ban IP]<br>[Delete Comment]</P>";

print "<hr>";

}
?> 


Link to comment
https://forums.phpfreaks.com/topic/47972-this-is-probably-easy/
Share on other sites

I am stuck on trying to get my buttons to do what they say they do.

 

I want the Delete Comment link to delete the contents of the comment field from that specific entry.

 

I want the Ban IP link to insert the IP of the user who posted that specific signature into the ipban database. &

 

I want the Delete Entry link to delete the entire entry from the database.

 

Each of these buttons will be listed for each of the entries.

Link to comment
https://forums.phpfreaks.com/topic/47972-this-is-probably-easy/#findComment-234958
Share on other sites

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.