PHP - Creating Delete Button While Reading The Message
Hi, I'm doing a simple e-mail using localhost, while doing the rest, I realized I need a delete button for it. Is there a simple way to delete the message when the user opens the mail content?
This is the code I did for read_pm.php: Code: [Select] <?php include('config.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="<?php echo $design; ?>/style.css" rel="stylesheet" title="Style" /> <title>Read a PM</title> <script type="text/javascript"> <!-- function FP_swapImg() {//v1.0 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length; n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm; elm.$src=elm.src; elm.src=args[n+1]; } } } function FP_preloadImgs() {//v1.0 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array(); for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; } } function FP_getObjectByID(id,o) {//v1.0 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id); else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el; if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c) for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; } f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements; for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } } return null; } // --> </script> <style type="text/css"> .auto-style2 { font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif; text-align: left; } .auto-style4 { color: #FFFFFF; } .auto-style1 { font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif; } </style> </head> <body onload="FP_preloadImgs(/*url*/'default/images/buttonD5.jpg',/*url*/'default/images/buttonD6.jpg',/*url*/'default/images/button51.jpg',/*url*/'default/images/button52.jpg')"> <div class="header"> <a href="<?php echo $url_home; ?>"><img src="<?php echo $design; ?>/images/logo.png" alt="Members Area" /></a> </div> <?php //We check if the user is logged if(isset($_SESSION['email'])) { //We check if the ID of the discussion is defined if(isset($_GET['id'])) { $id = intval($_GET['id']); //We get the title and the narators of the discussion $req1 = mysql_query('select title, user1, user2 from pm where id="'.$id.'" and id2="1"'); $dn1 = mysql_fetch_array($req1); //We check if the discussion exists if(mysql_num_rows($req1)==1) { //We check if the user have the right to read this discussion if($dn1['user1']==$_SESSION['userid'] or $dn1['user2']==$_SESSION['userid']) { //The discussion will be placed in read messages if($dn1['user1']==$_SESSION['userid']) { mysql_query('update pm set user1read="yes" where id="'.$id.'" and id2="1"'); $user_partic = 2; } else { mysql_query('update pm set user2read="yes" where id="'.$id.'" and id2="1"'); $user_partic = 1; } //We get the list of the messages $req2 = mysql_query('select pm.timestamp, pm.message, users.id as userid, users.username from pm, users where pm.id="'.$id.'" and users.id=pm.user1 order by pm.id2'); //We check if the form has been sent if(isset($_POST['message']) and $_POST['message']!='') { $message = $_POST['message']; //We remove slashes depending on the configuration if(get_magic_quotes_gpc()) { $message = stripslashes($message); } //We protect the variables $message = mysql_real_escape_string(nl2br(htmlentities($message, ENT_QUOTES, 'UTF-8'))); //We send the message and we change the status of the discussion to unread for the recipient if(mysql_query('insert into pm (id, id2, title, user1, user2, message, timestamp, user1read, user2read)values("'.$id.'", "'.(intval(mysql_num_rows($req2))+1).'", "", "'.$_SESSION['userid'].'", "", "'.$message.'", "'.time().'", "", "")') and mysql_query('update pm set user'.$user_partic.'read="yes" where id="'.$id.'" and id2="1"')) { ?> <div class="message"><strong><span class="auto-style4">Your message has successfully been sent.</span></strong><br /> <a href="read_pm.php?id=<?php echo $id; ?>">Back to Message</a></div> <?php } else { ?> <div class="message"><strong><span class="auto-style4">An error occurred while sending the message.</span></strong><br /> <a href="read_pm.php?id=<?php echo $id; ?>">Back to Message</a></div> <?php } } else { //We display the messages ?> <div class="content"> <table class="messages_table"> <tr> <th class="auto-style2" style="height: 27px; width: 64px">Subject : <?php echo $dn1['title']; ?></th> </tr> <?php while($dn2 = mysql_fetch_array($req2)) { ?> <tr> <td class="auto-style2" style="height: 50px; width: 64px"> <div class="auto-style2">Sent by: <a href="profile.php?id=<?php echo $dn2['userid']; ?>"><?php echo $dn2['username']; ?> on <?php echo date('d/m/Y, g:i a' ,$dn2['timestamp']); ?></div> <br> <?php echo $dn2['message']; ?></a><br></td> </tr> <?php } //We display the reply form ?> </table> <br /> <div class="center"> <form action="read_pm.php?id=<?php echo $id; ?>" method="post"> <img id="img7" alt="Reply" fp-style="fp-btn: Braided Row 1; fp-font-style: Bold" fp-title="Reply" height="24" src="default/images/button53.jpg" style="border: 0" width="120" class="auto-style1" onmousedown="FP_swapImg(1,0,/*id*/'img7',/*url*/'default/images/button52.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img7',/*url*/'default/images/button53.jpg')" onmouseover="FP_swapImg(1,0,/*id*/'img7',/*url*/'default/images/button51.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img7',/*url*/'default/images/button51.jpg')"><br> <textarea rows="5" name="message" id="message" style="width: 311px"></textarea><br><br /> <input type="submit" value="Send" /> </form> </div> </div> <?php } } else { echo '<div class="message">You do not have the rights to access this page.</div>'; } } else { echo '<div class="message">This private message does not exists.</div>'; } } else { echo '<div class="message">The private message ID is not defined.</div>'; } } else { echo '<div class="message">You must be logged to access this page. Please register.</div>'; } ?> <div class="foot"><a href="list_pm.php"> <img id="img1" alt="Back to Inbox" fp-style="fp-btn: Braided Row 3; fp-font-style: Bold" fp-title="Back to Inbox" height="24" onmousedown="FP_swapImg(1,0,/*id*/'img1',/*url*/'default/images/buttonD6.jpg')" onmouseout="FP_swapImg(0,0,/*id*/'img1',/*url*/'default/images/buttonD4.jpg')" onmouseover="FP_swapImg(1,0,/*id*/'img1',/*url*/'default/images/buttonD5.jpg')" onmouseup="FP_swapImg(0,0,/*id*/'img1',/*url*/'default/images/buttonD5.jpg')" src="default/images/buttonD4.jpg" style="border: 0" width="120"></a></div> </body> </html> Similar TutorialsHi all. Here is my scripts which allow user to check multiple rows of data and delete it , but it require select data and click for twice to delete the rows , what should be the error? Code: [Select] <form name="frmSearch" method="post" action="insert-add.php"> <table width="600" border="1"> <tr> <th width="50"> <div align="center">#</div></th> <th width="91"> <div align="center">ID </div></th> <th width="198"> <div align="center">First Name </div></th> <th width="198"> <div align="center">Last Name </div></th> <th width="250"> <div align="center">Mobile Company </div></th> <th width="100"> <div align="center">Cell </div></th> <th width="100"> <div align="center">Workphone </div></th> <th width="100"> <div align="center">Group </div></th> </tr> </form> <? echo "<form name='form1' method='post' action=''>"; while($objResult = mysql_fetch_array($objQuery)) { echo "<tr>"; echo "<td align='center'><input name=\"checkbox[]\" type=\"checkbox\" id=\"checkbox[]\" value=\"$objResult[addedrec_ID]\"></td>"; echo "<td>$objResult[addedrec_ID] </td>"; echo "<td>$objResult[FirstName]</td>"; echo "<td>$objResult[LastName] </td>"; echo "<td>$objResult[MobileCompany] </td>"; echo "<td>$objResult[Cell] </td>"; echo "<td>$objResult[WorkPhone] </td>"; echo "<td>$objResult[Custgroup] </td>"; echo "</tr>"; } echo "<td colspan='7' align='center'><input name=\"delete\" type=\"submit\" id=\"delete\" value=\"Delete\">"; if (isset($_POST['delete']) && isset($_POST['checkbox'])) // from button name="delete" { $checkbox = ($_POST['checkbox']); //from name="checkbox[]" $countCheck = count($_POST['checkbox']); for($d=0;$d<$countCheck;$d++) { $del_id = $checkbox[$d]; $sql = "DELETE from UserAddedRecord where addedrec_ID = $del_id"; $result2=mysql_query($sql) or trigger_error(mysql_error());;; } if($result2) { $fgmembersite->GetSelfScript(); } else { echo "Error: ".mysql_error(); } } echo "</form>"; Thanks for every reply. Whenever I hit the submit button, it's not even reading if they hit it and doing all that if and else statements I have. Why is not noticing the submit button? I had this working last night, but my dumb self saved over it with another file I was editing. Code: [Select] <?php session_start(); include("config.php"); include("logincheck.php"); $time = date_default_timezone_set("US/Eastern"); $timeformat = date("Y-m-d H:i:s"); $author = $_SESSION['username']; $title = $_POST['title']; $body = $_POST['body']; if (isset($_POST['submit'])) { if (!empty($title)) { if (!empty($body)) { $sql = "INSERT INTO news (author, title, body, time) VALUES ('$author', '$title', '$body', NOW())"; mysqli_query($cxn, $sql); $error = "Your news posting has been submitted successfully."; } else { $error = "You must fill out the body of the posting!"; } } else { $error = "You must fil out the title of the posting!"; } } $sql = "SELECT userlevel FROM members WHERE userid='".$_SESSION['userid']."'"; $result = mysqli_query($cxn, $sql); $row = mysqli_fetch_array($result); if ($row['userlevel'] != 2) { $error = "You do not have the power to view this page!"; header("Location: news.php"); } else { ?> <?php include("header.php"); ?> <h1>Post News</h1> <?php echo $error; ?> <form method="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post"> <b>Author:</b> <?php echo $author; ?><br> <b>Title:</b><br> <input type="text" maxlength="25" name="title" value="<?php echo $title; ?>" /><br> <b>Body:</b><br> <textarea name="body" maxlength="999" rows="10" cols="40"><?php echo $body; ?></textarea><br> <input type="submit" name="submit" value="Post News" /> </form> <?php } ?> <?php include("footer.php"); ?> Im displaying the results of a database by using a while loop... so Im trying to figure out how to delete some entries from the datbase. What I wanted to do is add a button in each result that will have the value "delete"... but I cant figure out how to do this. Im kinda new to mysql. I just want it so when I click the button the result will get deleted from the database. I did some research on this but I cant really grasp the examples. Can anybody help me out with this one? Thanks! Hey guys just wandered if you can help me on my website in the mailbox section next to the message there is a delete button to obviously delete that current message.
However as I am sure you can appreciate it get tedious when you have 20 messages to do them all at once.
So I am after putting a button at the top of this column in the table that will delete all the messages in there with one click.
Below is the coding of where all this takes place:
function mailbox($mes,$page) { global $config; if(!$page) { $page="1"; } $page=($page - 1); $totalmes=mysql_query("SELECT COUNT(*) FROM messages WHERE toid='".$_SESSION['tid']."' AND rcvddel=0"); $totalmes=mysql_result($totalmes,0); $out[body].=" <div style='float:left;width:69%;margin:5px;'> <table cellspacing='1' cellpadding='1' border='0' width='100%'> <tr> <td width='100%' class='blk_tcon' colspan='5'><b>" . LANG_MAI_MAILBOX . "</b></td> </tr> <tr> <td width='50%' colspan='2' class='blk_tcon_top'>" . LANG_MAI_SUBJECT . "</td> <td width='20%' class='blk_tcon_top'>" . LANG_MAI_FROM . "</td> <td width='25%' class='blk_tcon_top'>" . LANG_MAI_DATE . "</td> <td width='5%' class='blk_tcon_top'></td> </tr>"; $fmail=mysql_query("SELECT id,fromid,subject,active,sent FROM messages WHERE toid='".$_SESSION['tid']."' AND grid='1' AND rcvddel=0 ORDER BY sent DESC LIMIT $page, 15"); while(list($id,$fromid,$subject,$active,$sent)=mysql_fetch_row($fmail)) { $from=mysql_query("SELECT name FROM members WHERE id='$fromid'"); $from=mysql_fetch_array($from); if($fromid == '01') { $froma="Site Challenge"; }else{ $froma="<a href='./profile.php?account=$fromid'>$from[name]</a>"; } if($active == 1) { $icon="<img src='./images/unread.gif' border='0' alt='' />"; $title="<a href='./mailbox.php?action=readmail&mailtype=received&mid=$id'><b>$subject</b></a>"; }else if($active == 2){ $icon="<img src='./images/read.gif' border='0' alt='' />"; $title="<a href='./mailbox.php?action=readmail&mailtype=received&mid=$id'>$subject</a>"; }else{ $icon="<img src='./images/replied.gif' border='0' alt='' />"; $title="<a href='./mailbox.php?action=readmail&mailtype=received&mid=$id'>$subject</a>"; } $out[body].=" <tr> <td width='5%' align='center' class='blk_tcon'>$icon</td> <td width='45%' align='left' class='blk_tcon'>$title</td> <td width='20%' align='center' class='blk_tcon'>$froma</td> <td width='25%' align='center' class='blk_tcon'>$sent</td> <td width='5%' align='center' class='blk_tcon'> <form method='post'> <input type='hidden' name='mail[id]' value='$id' /> <input type='hidden' name='mail[mailtype]' value='received' /> <input type='hidden' name='action' value='delete' /> <input type='submit' class='button' name='submit' value='X' style='color:red; font-weight:bold;' title='" . LANG_MAI_DELETE . "' /> </form> </td> </tr>"; } if($totalmes == 0) { $out[body].=" <tr> <td width='100%' align='center' colspan='5' class='blk_tcon'>" . LANG_MAI_MAILBOX_EMPTY . "</td> </tr>"; } $pagenow=($page + 1); $pages=1; if($pagenow==1) { $skipranks.="[$pages] "; }else{ $skipranks.="<a href='./mailbox.php?page=1'>$pages</a> "; } $arank=1; $brank=15; while($brank < $totalmes) { $arank=($arank + 15); $brank=($brank + 15); $pages++; if($pagenow==$arank) { $skipranks.="[$pages] "; }else{ $skipranks.="<a href='./mailbox.php?page=$arank'>$pages</a> "; } } $out[body].=" <tr> <td width='100%' align='center' class='blk_tcon' colspan='5'>$skipranks</td> </tr> </table> </div> ".TOP_MENU.""; include("$config[html]"); } </tr>"; Hi I have made this simple login page by setcookies function and I want now to make a logout button. Here the codeĀ <?php /* PHP Form Login Remember Functionality with Cookies */ if(!empty($_POST["remember"])) { setcookie ("username",$_POST["username"],time()+ 3600); setcookie ("password",$_POST["password"],time()+ 3600); setcookie ("color",$_POST["color"],time()+ 3600); //3600 = 1 hour //86400 = 1 day //(8640*30) = 1 month echo "Cookies Set Successfuly"; } else { setcookie("username",""); setcookie("password",""); setcookie("color",""); echo "Cookies Not Set"; } ?> <form action="Cookies.php" method="post" style="border: 2px dotted blue; text-align:center; width: 400px;"> <p>Welcome <?php echo ( !empty($_POST ['username']) ) ? $_POST ['username'] : 'USER'; ?> </p> <p>Username: <input name="username" type="text" value="<?php if(isset($_COOKIE["username"])) { echo $_COOKIE["username"],( !empty($_POST ['username']) ) ? $_POST ['username'] : '';} ?>" > </p> <p>Password: <input name="password" type="password" value=" <?php if(isset($_COOKIE["password"])) { echo $_COOKIE["password"]; } ?>" > </p> <p>Choose Your Favorite Color: <input name="color" type="color" value="<?php if(isset($_COOKIE["color"])) { echo $_COOKIE["color"]; } ?>"> </p> <p><input type="checkbox" name="remember" /> Remember me</p> <p><input type="submit" value="Login"></p> </form> Any idea ?? I have a download-list, and want to have a delete-button/link at each file. I have tried different codes, but i'm new to php and need some help. if ($handle = opendir('files/engelsk/')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $en .= '» <a href="/files/engelsk/'.$file.'">'.$file.'</a> - <i><a href="#">Delete file</a></i><br />'; } } closedir($handle); } It's the "<a href="#">Delete file</a>" I want to be the delete-button. Please help! Hi,
So I have a private page where I have a delete button.
The delete button just links to a page something like this: mysite.com/?postid=123&confirm=1 When confirm is set, the page is deleted.
The problem is, a malicious person could reverse engineer the URL and trick (logged in) users of the site into clicking the link.
How can I verify that the last page visited was from my site, in the private section?
Possible solutions:
I was thinking HTTP_REFERER (mispelled due to html standard stupidity), but heard it's not robust.
Right now I'm just setting a cookie for 1 minute, to limit the likelihood of hacking, but wonder if there is a better way.
Hi I've been scouring the net and I cant find anything that works. Can someone tell me how to put a delete button next to each record? Any help is appreciated, thank you! Code: [Select] $term = strtolower ($_POST['term']); $sql = mysql_query("select * from $table where first like '%$term%' or last like '%$term%'"); while ($row = mysql_fetch_array($sql)){ echo 'ID: '.$row['id']; echo '<br/> first: '.$row['first']; echo '<br/> last: '.$row['last']; echo '<br/> phone: '.$row['phone']; echo '<br/> mobile: '.$row['mobile']; echo '<br/> fax: '.$row['fax']; echo '<br/> email: '.$row['email']; echo '<br/> web: '.$row['web']; echo '<br/><br/>'; } ?> </p> registration.php Code: [Select] <html> <body> <form name="register" method="post" action="login.php" //onsubmit="return a()"> <table border='0'> <tr><td>Username:</td><td><input type='text'name='username' maxlength='60'></td></tr> <tr><td>Password:</td><td><input type='password' name='pass' maxlength='10'></td></tr> <tr><td>Confirm Password:</td><td><input type='password' name='pass2' maxlength='10'></td></tr> <tr><th colspan=2><input type='submit' name='sub' value='Register'></th></tr> </table> </form> <body> </html> and this direct to login page where the code is Code: [Select] <?php mysql_connect("localhost","root") or die(mysql_error()); mysql_select_db("Regis") or die(mysql_error()); if (isset($_POST['sub'])) { $message=strip_tags($message); if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) { echo("<SCRIPT LANGUAGE='JavaScript'>window.alert('You did not complete all of the required fields')</SCRIPT>"); return false; } // checks if the username is in use if (!get_magic_quotes_gpc()) { $_POST['username'] = addslashes($_POST['username']); } $usercheck = $_POST['username']; $check = mysql_query("SELECT username FROM registration WHERE username = '$usercheck'") or die(mysql_error()); $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) { print ('Sorry, the username '.$_POST['username'].' is already in use.'); } if ($_POST['pass'] != $_POST['pass2']) { print ('Your passwords did not match. '); } // here we encrypt the password and add slashes if needed $_POST['pass'] = md5($_POST['pass']); if (!get_magic_quotes_gpc()) { $_POST['pass'] = addslashes($_POST['pass']); $_POST['username'] = addslashes($_POST['username']); } // now we insert it into the database if($_POST['username'] && $_POST['pass'] && $_POST['pass2'] ) { $insert = "INSERT INTO registration (username, password) VALUES ('".$_POST['username']."', '".$_POST['pass']."')"; $add_member = mysql_query($insert); echo("<SCRIPT LANGUAGE='JavaScript'>window.alert('Registration had been succesfully added :)')</SCRIPT>"); } } //if the login form is submitted /* if (isset($_POST['submit'])) { // makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database if (!get_magic_quotes_gpc()) { $_POST['email'] = addslashes($_POST['email']); } $check = mysql_query("SELECT * FROM registration WHERE username = '".$_POST['username']."'")or die(mysql_error()); //Gives error if user dosen't exist $check2 = mysql_num_rows($check); if ($check2 == 0) { die('That user does not exist in our database. <a href=register.php>Click Here to Register</a>'); } while($info = mysql_fetch_array( $check )) { $_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']); //gives error if the password is wrong if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); } } } else { // if they are not logged in ?> <form action="submit.php" method="post"> <table border="0"> <tr><td colspan=2><h1>Login</h1></td></tr> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="40"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="50"> </td></tr> <tr><td><a href=register.php>Register</a></td> <td><input type="submit" name="submit" value="Login"> </td></tr> </table> </form> <?php } */ ?> My problem is when the code is reading this statement if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) { echo("<SCRIPT LANGUAGE='JavaScript'>window.alert('You did not complete all of the required fields')</SCRIPT>"); return false; } ya it is appear that alert box but it will direct to login page im want it to be in registration page any modification on my code? Hi, I'm new to the forum so this could go in the MySQL section but I'm not sure. I am trying to make a page that will list all records from a column in HTML table and have a delete button to remove a specific record. I have got to the part where I have listed the records in a table. Note: Only records from a specific column ('links') are printed. Here is the code: Code: [Select] $con = mysql_connect("localhost","***","***"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("***", $con); $result = mysql_query("SELECT * FROM main"); echo "<table border='1'> <tr> <th>Current links</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['links'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); How would I go about adding a delete button next to each record to delete that specific record? Thanks for any help. Hello, I am new to php, and what I need to know and learn is a part of an assignment I normally wouldn't ask for help on the net for an assignment but my teacher is not very helpful and other students are struggling too! I have searched the net inside and out and have tried many things. My problem is that I am trying to remove a line from an array by clicking a delete button. The outpur I need is: a line of text that comes from my text file after it is exploded into an array | With a delete button here next line of text that comes from my text file after it is exploded into an array | With a delete button here etc I have managed to write this much myself - Code: [Select] <?php $file = fopen('fav/fav.txt', 'r'); $file = file_get_contents('fav/fav.txt'); $file_array = explode("\n",$file); array_pop($file_array); foreach($file_array as $line) { echo "<form method='post' action=''>".$line. "<input type='submit' name='post' value='delete'><br>"; $fh = fopen("fav/fav.txt",'w'); foreach ($file_array as $line) { fwrite($fh,$line."\n"); } fclose($fh); } ?> The array_pop deletes from the bottom instead of the line the button is next too, I realise I will need to use and if statement but this is the closest I have gotten. Thanks in advance!!! I am new to php and I thought it best to start by using a CMS and creating small functions to extend it's functionality. I will start by explaining the situation around what I want to do. I am trying to create a module for the drupal CMS. The module I am trying to create I am creating for my girlfriends son (for when it is complete he will be the one maintaining it through the web interface). He wants a game server (WOW) and a web site that once they create an account on the web site it will create an account on the game server as well. If I understand the way this works correctly for this game server to work you need a logon database and then a character and world database for each realm you have. With that basically what happens is you go to the drupal web site and click create account, input a username, email address and password and agree to terms of service. Then drupal does some checks and writes the information to the drupal database and with the module I creating it will write to the logon database as well. I am working on the admin forms so you can edit how many realms the server has the sql statement to login to the game and add and delete realms. I have been looking at an example of a form for drupal here http://drupal.org/node/717746 but have converted it to my purpose and it brings up some questions here is what I have so far: function wowcp_gameserver_settings($form_state) { $form['server'] = array( '#type' => 'fieldset', '#title' => t('WOW Game Server Core'), ); $form['server']['decision'] = array( '#type' => 'select', '#title' => 'Select the Server Core that your WOW server runs on', '#options' => array('TrinityCore2', 'ArcEMU', 'Aspire', 'Mangos'), '#default_value' => TrinityCore2, ); $form['server']['sql_command'] = array( '#type' => 'textfield', '#title' => 'Select the SQL command for your server core', '#size' => 150, ); $form['server']['max_realms'] = array( '#type' => 'textfield', '#title' => t('Select the maximum realms allowed'), '#size' => 2, ); $form['logon'] = array( '#type' => 'fieldset', '#title' => t('WOW Game Server LOGON database setup') ); $form['logon']['logon_db'] = array( '#type' => 'textfield', '#title' => t('Enter the name of the LOGON database'), '#size' => 25, ); $form['logon']['logon_username'] = array( '#type' => 'textfield', '#title' => t('Enter the username for the LOGON database'), '#size' => 25, ); $form['logon']['logon_password'] = array( '#type' => 'textfield', '#title' => t('Enter the password for the LOGON database'), '#size' => 25, ); $form['realm']['character'] = array( '#type' => 'fieldset', '#title' => t('WOW Game Server first realm'), ); $form['realm']['character']['character_db'] = array( '#type' => 'textfield', '#title' => t('Enter the name of the CHARACTER database'), '#default_value' => $form_state['values']['character_db'], '#size' => 25, ); $form['realm']['character']['character_username'] = array( '#type' => 'textfield', '#title' => t('Enter the username for the CHARACTER database'), '#default_value' => $form_state['values']['character_username'], '#size' => 25, ); $form['realm']['character']['character_password'] = array( '#type' => 'textfield', '#title' => t('Enter the password for the CHARACTER database'), '#default_value' => $form_state['values']['character_password'], '#size' => 25, ); $form['realm']['world']['world_db'] = array( '#type' => 'textfield', '#title' => t('Enter the name of the WORLD database'), '#defaule_value' => $form_state['values']['world_db'], '#size' => 25, ); $form['realm']['world']['world_username'] = array( '#type' => 'textfield', '#title' => t('Enter the username for the WORLD database'), '#defaule_value' => $form_state['values']['world_username'], '#size' => 25, ); $form['realm']['world']['world_password'] = array( '#type' => 'textfield', '#title' => t('Enter the password for the WORLD database'), '#defaule_value' => $form_state['values']['world_password'], '#size' => 25, ); if (isset($form_state['storage']['new_name'])) { $form['character2'] = array( '#type' => 'fieldset', '#title' => t('WOW Game Server CHARACTER database setup for realm2'), ); $form['character2']['character_db2'] = array( '#type' => 'textfield', '#title' => t('Enter the name of the CHARACTER database for relam2'), '#default_value' => $form_state['values']['character_db2'], '#size' => 25, ); $form['character2']['character_username2'] = array( '#type' => 'textfield', '#title' => t('Enter the username for the CHARACTER database for realm2'), '#default_value' => $form_state['values']['character_username2'], '#size' => 25, ); $form['character2']['character_password2'] = array( '#type' => 'textfield', '#title' => t('Enter the password for the CHARACTER database for realm2'), '#default_value' => $form_state['values']['character_password2'], '#size' => 25, ); $form['world2'] = array( '#type' => 'fieldset', '#title' => t('WOW ame Server WORLD database setup for realm2'), ); $form['world2']['world_db2'] = array( '#type' => 'textfield', '#title' => t('Enter the name of the WORLD database for realm2'), '#defaule_value' => $form_state['values']['world_db2'], '#size' => 25, ); $form['world2']['world_username2'] = array( '#type' => 'textfield', '#title' => t('Enter the username for the WORLD database for realm2'), '#defaule_value' => $form_state['values']['world_username2'], '#size' => 25, ); $form['world2']['world_password2'] = array( '#type' => 'textfield', '#title' => t('Enter the password for the WORLD database for realm2'), '#defaule_value' => $form_state['values']['world_password2'], '#size' => 25, ); } $form['submit'] = array( '#type' => 'submit', '#value' => 'Submit', ); $form['clear'] = array( '#type' => 'submit', '#value' => 'Reset', '#validate' => array('wowcp_form_clear'), ); if (empty($form_state['storage']['new_name'])) { $form['new_name'] = array( '#type' => 'submit', '#value' => 'Add Realm', '#validate' => array('wowcp_form_new_name'), ); $form['delete'] = array( '#type' => 'submit', '#value' => 'Delete Realm', '#validate' => array('wowcp_form_delete'), ); } return $form; } If max_realms is set to a large number the way I see it you would have to hard code everything into the php file. Instead of that could you not remove from the if(isset) and have it that when they click on the add realm button check to make sure the textfield contains a number if it doesn't return an error if it does contain a number make sure it is not greater then max_realms and then use a start count and adding that number to all the arrays for that realm and validate all the information is what you expect. I think this would work for adding realms, I think where the problem would come in is in deleting realms (or it could be me over thinking it). For example if you have max_realms set to 4 you could have 5 the one default one that can't be deleted plus 4 others and the ones that can be deleted would be called realm1 - realm4 if you delete the first 2 you would minus count by 2 so if you clicked add realm again it would try and create realm3 which already exists. Is there another way on doing this that you could create the realms and delete them and it not try to add realms with the same array name? the info posts beautifully i just canst seem to get the button to auto click or submit, tried numerous ways! help Code: [Select] <?php require_once "../store/paypal/utility.php"; require_once "../store/paypal/constants.php"; $url = "https://www.".DEFAULT_ENV.".paypal.com/cgi-bin/webscr"; $postFields = "cmd=".urlencode("_notify-synch"). "&tx=".urlencode(htmlspecialchars($_GET["tx"])). "&at=".urlencode(DEFAULT_IDENTITY_TOKEN); $ppResponseAr = Utils::PPHttpPost($url, $postFields, true); if(!$ppResponseAr["status"]) { Utils::PPError($ppResponseAr["error_msg"], $ppResponseAr["error_no"]); exit; } $httpParsedResponseAr = $ppResponseAr["httpParsedResponseAr"]; // assign posted variables to local variables $item_name = $httpParsedResponseAr['item_name']; $item_number = $httpParsedResponseAr['item_number']; $receiver_email = $httpParsedResponseAr['receiver_email']; $receiver_id = $httpParsedResponseAr['receiver_id']; $quantity = $httpParsedResponseAr['quantity']; $first_name = $httpParsedResponseAr['first_name']; $last_name = $httpParsedResponseAr['last_name']; $payer_email = $httpParsedResponseAr['payer_email']; $txn_type = $httpParsedResponseAr['txn_type']; $address_street = $httpParsedResponseAr['address_street']; $address_city = $httpParsedResponseAr['address_city']; $address_state = $httpParsedResponseAr['address_state']; $address_zip = $httpParsedResponseAr['address_zip']; $item_number = $httpParsedResponseAr['item_number']; $option_name1 = $httpParsedResponseAr['option_name1']; $option_selection1 = $httpParsedResponseAr['option_selection1']; $option_name2 = $httpParsedResponseAr['option_name2']; $option_selection2 = $httpParsedResponseAr['option_selection2']; $invoice = $httpParsedResponseAr['invoice']; $custom = $httpParsedResponseAr['custom']; $payer_id =$httpParsedResponseAr['payer_id']; ?> <html lang="en"> <head> <title>Rec</title> <link REL="stylesheet" href="include/style.css" type="text/css"> <!--[if IE]> <link REL="stylesheet" href="include/styleIE.css" type="text/css"> <![endif]--> <style> #center_block {width:50%;margin:0 auto;min-width:500px;} #contents_block {text-align:center;} #header_block {white-space:nowrap;height:25px;padding:0 10px 5px;text-align:center;} #fields_block {width:100%;margin:0;padding:10px} #header_block span {margin:0 5px} #buttons_block {padding:10px 10px 5px} #buttons_block div {padding:3px} #delimiter {margin:2px} #fields_block td {padding:3px 14px} #username_block td {padding-top:13px;white-space:nowrap;} #remember_block td {padding-bottom:13px;white-space:nowrap;} #required_block {text-align:left;padding:5px} </style> <!--[if IE]> <style> #main_block {width:100%} </style> <![endif]--> </head> <body> <script language="JavaScript" src="include/jquery.js"></script> <script language="JavaScript" src="include/jsfunctions.js"></script> <script language="JavaScript" src="include/runnerJS/RunnerBase.js"></script> <form action="rec.php" method="post" id="rec" name="rec.php"> <table id="center_block" align="center"> <tr><td id="contents_block"> <div class="main_table_border2 loginshade" id="main_block"> <table cellpadding=0 cellspacing=0 border=0 id="fields_block" class="loginshade"> <tr id="email_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_email_1">Email:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_email_0" style="white-space: nowrap;"><input id="value_email_1" style="" type="text" name="value_email_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["payer_email"]) ?>"> <font color="red">*</font></span> <div class="error"></div> </td> </tr> <tr id="pass_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_pass_1">Pass:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_pass_0" style=""><input style="" id="value_pass_1" type="Password" name="value_pass_1" maxlength=50 value="1234"> <font color="red">*</font></span> <div class="error"></div> </td> </tr> <tr id="confirm_block"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_confirm_1">Re-enter password:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_confirm_0" style=""><input style="" id="value_confirm_1" type="Password" name="value_confirm_1" value="1234"> <font color="red">*</font></span> <div class="error"></div> </td> </tr> <tr id="fname_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_fname_1">First Name:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_fname_0" style="white-space: nowrap;"><input id="value_fname_1" style="" type="text" name="value_fname_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["first_name"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="lname_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_lname_1">Last Name:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_lname_0" style="white-space: nowrap;"><input id="value_lname_1" style="" type="text" name="value_lname_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["last_name"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="address_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_address_1">Address:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_address_0" style="white-space: nowrap;"><input id="value_address_1" style="" type="text" name="value_address_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_street"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="city_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_city_1">City:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_city_0" style="white-space: nowrap;"><input id="value_city_1" style="" type="text" name="value_city_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_city"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="state_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_state_1">State:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_state_0" style="white-space: nowrap;"><input id="value_state_1" style="" type="text" name="value_state_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_state"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="zip_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_zip_1">Zip:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_zip_0" style="white-space: nowrap;"><input id="value_zip_1" style="" type="text" name="value_zip_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["address_zip"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="cosponsor_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_cosponsor_1">Cosponsor:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_cosponsor_0" style=""><input id="type_cosponsor_1" type="hidden" name="type_cosponsor_1" value="checkbox"><input id="value_cosponsor_1" type="Checkbox" name="value_cosponsor_1" ></span> </td> </tr> <tr id="recipients_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_recipients_1">Recipients:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_recipients_0" style="white-space: nowrap;"><input id="value_recipients_1" style="" type="text" name="value_recipients_1" maxlength=50 value="<?php echo urldecode($httpParsedResponseAr["quantity"]) ?>"> <font color="red">*</font></span> </td> </tr> <tr id="clients_fieldblock"> <td align=left width=50% class=loginshade> <div align="left"><label for="value_clients_1">Clients:</label></div> </td> <td width=50% class=loginshade> <span id="edit1_clients_0" style=""><input id="type_clients_1" type="hidden" name="type_clients_1" value="checkbox"><input id="value_clients_1" type="Checkbox" name="value_clients_1" ></span> </td> </tr> <tr id="space_block"></tr> </table> </div> </td></tr> </table> <input type=submit value="Submit" class=button id="saveButton1" onload="Submit"></form> </body> </html> Some help would be great here. The following snippets work, but I am unable to figure out how to activate the error message "You did not select a name for editing". Both of the other error codes work but if I input 'given' and 'family' and forget to select the relevant radio button, the error message doesn't work. No other problems with the code. Code: [Select] <html> <table> <?php // Query member data from the database $query1 = mysql_query("SELECT userId FROM users WHERE managerId='".$recid."' AND userGroup='".$group2."' ORDER BY userId ASC"); while($row1 = mysql_fetch_array($query1)) { $firstGroup .=$row1['userId']. ' <input type="radio" name="snames" value="'.$row1['userId'].'" /> ' . " <br /><br>"; } ?> <form method="post" enctype="multipart/form-data" action="<?PHP echo $_SERVER["PHP_SELF"]; ?>"> <tr> <td><?php echo $firstGroup;?></td> <td><input type="text" name="given" value="" /><p> <input type="text" name="family" value="" /><p> <input type="submit" value="submit" name="Send Data"></form></td> </tr> </table> </html Here are the error messages and their activation method. Code: [Select] <?php // Process the form if it is submitted if ($_POST['snames']) { $snames = $_POST['snames']; $family = preg_replace("/[^A-Za-z0-9]/", ".", $_POST['family']); $given = preg_replace("/[^A-Za-z0-9]/", ".", $_POST['given']); //next section deals with error messaging $errorMsg = "ERROR:"; if(!$snames) { $errorMsg .= "--- You did not select a name for editing."; } else if(!$family) { $errorMsg .= "--- You did not enter a family name."; } else if(!$given) { $errorMsg .= "--- You did not enter a given name."; } else { exit(); } }// close if post echo $errorMsg; ?> Hello,
First of all I'd like to say thank you for all the great information on the forums, I've been reading a lot on here lately.
I've started to make a website where users can log in and submit items to a database, which is then displayed on another page.
If Tom and Bill both post 10 items, all 20 items will be displayed on the "listings" page, however on the main log in screen Tom will only see his own 10 items and Bill will see his own 10 items.
This is all working perfectly, however, I now need to add a delete button so that they can delete specific items.
I have loosely followed this tutorial here to get the table to display as I want it (amongst a few other things, such as the user logins) http://www.wickham43...mphptomysql.php
I've added the delete button in the PHP loop for each row, I just can't figure out how to delete the specific row when clicked.
Any help would be really appreciated
Edited by eklem, 22 October 2014 - 08:10 AM. I have a dynamic script and need to create a click event function with JavaScript to delete the row which has a checkbox checked when the delete button is pressed. This is being implemented with PHP and as now serves as light code for this matter at hand. I was only able to delete all rows. I have my efforts with the js functions too. <script type="text/javascript"> var counter = 1; var limit = 6; function addTextArea() { if (counter == limit-1) { alert("Maximum limit " + counter + " sorry"); return false; } else { <!-- CAUTION THIS IS BACKWARDS. --> var newdiv = document.createElement('div'); newdiv.innerHTML = "" + (counter + 1) + " <br><textarea name='fav_det[]' id=counter rows='3' cols='20'>"; document.getElementById('div6').appendChild(newdiv); var newdiv = document.createElement('div'); newdiv.innerHTML = "" + (counter + 1) + " <br><textarea name='fav_col' id=counter rows='3' cols='20'>"; document.getElementById('div5').appendChild(newdiv); var newdiv = document.createElement('div'); newdiv.innerHTML = "" + (counter + 1) + " <br><textarea name='fav_mod[]' id=counter rows='3' cols='20'>"; document.getElementById('div4').appendChild(newdiv); var newdiv = document.createElement('div'); newdiv.innerHTML = " " + (counter + 1) + " <br><input type='text' name='truck[]' id=counter>"; document.getElementById('div3').appendChild(newdiv); var newdiv = document.createElement('div'); newdiv.innerHTML = " " + (counter + 1) + " <br><input type='text' name='car[]' id=counter>"; document.getElementById('div2').appendChild(newdiv); var newdiv = document.createElement('div'); newdiv.innerHTML = "" + (counter + 1) + " <br><input type='checkbox' name='chk[]' id=counter>"; document.getElementById('div1').appendChild(newdiv); counter++ return true; } } </script> <script type="text/javascript"> function deleteRowS(dataTable) { for (var rowi= table.rows.length; rowi-->0;) { var row= table.rows[rowi]; var inputs= row.getElementsByTagName('dataTable'); for (var inputi= inputs.length; inputi-->0;) { var input= inputs[inputi]; if (input.type==='checkbox' && input.checked) { row.parentNode.removeChild(row); break; } } } } </script> <script type="text/javascript"> function deleteRow() { var table = document.getElementById(tableID).tBodies[0]; var rowCount = table.rows.length; // var i=1 to start after header for(var i=1; i<rowCount; i++) { var row = table.rows[i]; // index of td contain checkbox is 8 var chkbox = row.cells[6].getElementsByTagName('input')[0]; if('checkbox' == chkbox.type && true == chkbox.checked) { table.deleteRow(i); } } }</script> </head> <table> <tr><td valign='top'><b>NEED DELETE ROW WITH CHECKBOX FUNCTION:</td></tr> </table> <table id="dataTable" width="auto" style="margin:-4px 0 0 0; padding:14px 0 0 0;" cellspacing="10px"><tbody id="dataTable"></tbody> <tr> <td valign='Top'> ✗ <div id="div1"> <input type="checkbox" name="chk[]" autocomplete="off" id="1" > </div> </td> <td valign='Top'> cars <div id="div2"> <input type="text" name="car[]" id="2" > </div> </td> <td valign='Top'> trucks <div id="div3"> <input type="text" name="truck[]" id="3" > </div> </td> <td valign='Top'> your favorite model <div id="div4"> <textarea name="mod[]" id="4" rows="3" cols="20"></textarea> </div> <br><br> </td> <td valign='Top'> your favorite add-ons <div id="div5"> <textarea name="fav_col" id="5" rows="3" cols="20"></textarea> </div> </td> <td valign='Top'> explain vehicle overall <div id="div6"> <textarea name="fav_det" id="6" rows="3" cols="20"></textarea> </div> </td> </tr> </table> <input type="button" value="Add another" onClick="addTextArea();" /> <input type="button" value="Delete row" onclick="deleteRow('dataTable');deleteRowS('dataTable')" /> I am working on a website for my landscape architecture master's thesis centered around the Google Earth API. Through out the site I have various test questions that I pass along as hidden fields from page to page to be entered into my database at the end. My problem is: I am trying to create a button that refreshes my Google earth div container ("APEarth") without refreshing the whole page. Currently, the button refreshes the whole page creating null entries for all the previous test questions. Any help would be greatly appreciated. My code is below. Just as a side note, my skills are very limited, so specific coding help would be greatly appreciated. <?php /*?>The items below are all the AP Elements in the Design View that make up the website <?php */?> <style type="text/css"> <!-- #APBody { position:absolute; left:0px; top:0px; width:1000px; height:700px; z-index:1; margin-top: 12pt; margin-left: 12pt; } #APUpperTitleBlock { position:absolute; left:0px; top:0px; width:1000px; height:50px; z-index:2; } #APBottomTitleBlock { position:absolute; left:0px; width:1000px; height:50px; z-index:6; bottom: 0px; } #APEarth { position:absolute; top:73px; width:800px; height:577px; z-index:4; right: 0px; border-color: #000; border-width: 2 px; } #ApContinue { position:absolute; left:0px; top:51px; width:1000px; height:18px; z-index:8; text-align: right; } #APLayers { position:absolute; left:0px; top:73px; width:200px; height:576px; z-index:9; font-family: Arial, "Arial Bold", "Arial Bold Italic", "Arial Black", "Arial Italic"; font-size: 14px; font-weight: bold; } --> </style> <title>Scenario Three</title> <style type="text/css"> <!-- #APBody #APLayers p { font-weight: normal; font-family: Arial, "Arial Bold", "Arial Bold Italic", "Arial Black", "Arial Italic"; } #GoogleEarthReset { position:absolute; left:4px; top:4px; width:192px; height:13px; z-index:1; } --> </style> <script type="text/javascript"> <!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <div id="APBody"> <div id="APUpperTitleBlock"><img src="Images/ScenarioThree_UTitleBlock.jpg" width="1000" height="50"></div> <div id="APBottomTitleBlock"><img src="Images/Website_LTitleBlock.jpg" width="1000" height="50"></div> <div id="ApContinue"> <form method="post" action="ScenarioThreeTest.php"> <?php /*?>Begin hidden pretest answers<?php */?> <input type="hidden" name="UniqueID" value="<?php echo $_POST['UniqueID']; ?>" /> <input type="hidden" name="GroupID" value="<?php echo $_POST['GroupID']; ?>" /> <input type="hidden" name="1_Age" value="<?php echo $_POST['1_Age']; ?>" /> <input type="hidden" name="2_Race" value="<?php echo $_POST['2_Race']; ?>" /> <input type="hidden" name="3_Education" value="<?php echo $_POST['3_Education']; ?>" /> <input type="hidden" name="4_Occupation" value="<?php echo $_POST['4_Occupation']; ?>" /> <input type="hidden" name="5_Income" value="<?php echo $_POST['5_Income']; ?>" /> <input type="hidden" name="6_SWM_Is" value="<?php echo $_POST['6_SWM_Is']; ?>" /> <input type="hidden" name="7_Landuse" value="<?php echo $_POST['7_Landuse']; ?>" /> <input type="hidden" name="8_Location" value="<?php echo $_POST['8_Location']; ?>" /> <input type="hidden" name="9_Participation" value="<?php echo $_POST['9_Participation']; ?>" /> <input type="hidden" name="10_Comments_Blog_Etc" value="<?php echo $_POST['10_Comments_Blog_Etc']; ?>" /> <input type="hidden" name="11_Web" value="<?php echo $_POST['11_Web']; ?>" /> <?php /*?>Begin hidden Scearnio One Test answers<?php */?> <input type="hidden" name="12_Scenario_One" value="<?php echo $_POST['12_Scenario_One']; ?>" /> <input type="hidden" name="13_Sustainable" value="<?php echo $_POST['13_Sustainable']; ?>" /> <input type="hidden" name="14_Effectiveness" value="<?php echo $_POST['14_Effectiveness']; ?>" /> <input type="hidden" name="15_Use_Techniques" value="<?php echo $_POST['15_Use_Techniques']; ?>" /> <input type="hidden" name="16_Willing_Scenario_One" value="<?php echo $_POST['16_Willing_Scenario_One']; ?>" /> <input type="hidden" name="17_Comments_Scenario_One" value="<?php echo $_POST['17_Comments_Scenario_One']; ?>" /> <?php /*?>Begin hidden Scenario Two Test answers<?php */?> <input type="hidden" name="18_Scenario_Two" value="<?php echo $_POST['18_Scenario_Two']; ?>"> <input type="hidden" name="19_Sustainable" value="<?php echo $_POST['19_Sustainable']; ?>"> <input type="hidden" name="20_Effectiveness" value="<?php echo $_POST['20_Effectiveness']; ?>"> <input type="hidden" name="21_Use_Techniques" value="<?php echo $_POST['21_Use_Techniques']; ?>"> <input type="hidden" name="22_Willing_Scenario_Two" value="<?php echo $_POST['22_Willing_Scenario_Two']; ?>"> <input type="hidden" name="23_Comments_Scenario_Two" value="<?php echo $_POST['23_Comments_Scenario_Two']; ?>"> <?php /*?>Continue to Scenario Three Button<?php */?> <input type="submit" value="Continue to Scenario Three Test" /> </form> </div> <div id="APLayers"> <form id="form1" name="form1" method="post" action=""> <p> <input type="submit" name="Refresh View" id="Refresh View" value="Refresh View" /> <br /> <br /> <a href="GEHelpVideo.html" target="_blank">Google Earth Help Video</a><a href="GEHelpVideo.html"></a></p> </form> <p><strong>Introduction: </strong></p> <p><em>Problem and/or Opportunity Identification:</em></p> <p>The Big Hollow drainage-way provides a unique opportunity for dense development. Its proximity to the urban core of State College and The Pennsylvania State University allows for continuity of development and alternative transportation. It also contains the necessary infrastructure to accomodate new development. </p> <p><em>Goal Establishment:<br /> </em><br /> 1. Expand and enhance the availability of different housing types and<br /> <br /> 2. Expand and enhance urban district growth with new commercial and industrial development.</p> </div> <div id="APEarth"></div> </div> <?php /*?>End Design View Elements<?php */?> <?php /*?>The following is the codefor Google Earth on GoDaddy.com<?php */?> <script src="http://www.google.com/jsapi?key=ABQIAAAAASFuJKi2srzH7vU9dQ775BSMepAERdnJfYrR64vZA9ytMBD-kBTzNLiWgdo_rLSrLhNdv2e5GaHvjg"> </script> <script type="text/javascript"> //Google Earth HTML var ge; google.load("earth", "1"); function init() { google.earth.createInstance('APEarth', initCB, failureCB); } function initCB(instance) { ge = instance; ge.getWindow().setVisibility(true); // add a navigation control ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO); // add an overview map ge.getOptions().setOverviewMapVisibility(true); //add the status bar ge.getOptions().setStatusBarVisibility(true); //add the scale legend ge.getOptions().setScaleLegendVisibility(true); ge.getOptions().setUnitsFeetMiles(true); // add some standsard google earth layers ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true); ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true); //add Big Hollow Well data KML File var href1 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Scenario3Wells.kml'; google.earth.fetchKml(ge, href1, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow existing zoning KML File var href3 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Scenario3ExLanduse.kml'; google.earth.fetchKml(ge, href3, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow proposed zoning KML File var href4 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Scenario3PropLanduse.kml'; google.earth.fetchKml(ge, href4, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow Video Placemark KmL File // var href5 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Landuse_Conflict_Video.kml'; // google.earth.fetchKml(ge, href5, function(kmlObject) { // if (kmlObject) // ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow Existing Buildings KML File var href6 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Scenario3ExBuildings.kml'; google.earth.fetchKml(ge, href6, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow Proposed Buildings KML File var href7 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Scenario3PropBuildings.kml'; google.earth.fetchKml(ge, href7, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); //add Big Hollow Potential Sinkhole KML File var href8 = 'http://www.iecoplanningstudio.com/Google_Earth_Files/Potential_Sinkhole.kml'; google.earth.fetchKml(ge, href8, function(kmlObject) { if (kmlObject) ge.getFeatures().appendChild(kmlObject);}); ///-------------------------------------------------------------------------------------------------------- //Test Placemark var placemark = ge.createPlacemark(''); // Define a custom icon. var icon = ge.createIcon(''); icon.setHref('http://maps.google.com/mapfiles/kml/shapes/movies.png'); var style = ge.createStyle(''); //create a new style style.getIconStyle().setIcon(icon); //apply the icon to the style placemark.setStyleSelector(style); //apply the style to the placemark // Set the placemark's location. var point = ge.createPoint(''); point.setLatitude( 40.800827); point.setLongitude(-77.881896); placemark.setGeometry(point); // Add the placemark to Earth. ge.getFeatures().appendChild(placemark); placemark.setName('Land Use Video!'); google.earth.addEventListener(placemark, 'click', function(event) { // prevent the default balloon from popping up event.preventDefault(); var balloon = ge.createHtmlStringBalloon(''); balloon.setFeature(placemark); // optional balloon.setMaxWidth(400); // YouTube video embed... the in the beginning is a fix for IE6 balloon.setContentString( ' <object width="400" height="300"><param name="movie" ' + 'value="http://www.youtube.com/v/6mrG_bsqC6k&hl=en&fs=1"/>' + '<param name="allowFullScreen" value="true"/>' + '<embed src="http://www.youtube.com/v/oN3TNoRudfE?hl=en&fs=1" ' + 'type="application/x-shockwave-flash" allowfullscreen="true" ' + 'width="400" height="300"></embed></object>'); ge.setBalloon(balloon); }); ///-------------------------------------------------------------------------------------------------------- //Get the Current View var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND); //Set New Latitude and Longitude lookAt.setLatitude(40.794709); lookAt.setLongitude(-77.887323); lookAt.setRange(10000); // Add to the current tilt lookAt.setTilt(lookAt.getTilt() + 60); //Update View ge.getView().setAbstractView(lookAt); } function failureCB(errorCode) { } google.setOnLoadCallback(init); //End Google Earth Coding </script> I made a table that gets the rows from a mysql table and lists them with the information on each row. What i need is an edit button at the end of the row so i can click it to change the data. What i want it to do is pop up a new window (child) that i can easily change the data by a text box, drop down menu, etc. and click submit to update it on the table. What i also need is a second button that will completely remove the data from that row in the table. I am still learning php and html and have no knowledge of javascript so any help would be appreciated! <body> <?php include 'sql.php'; $query = "SELECT * FROM validation"; $result = mysqli_query($con , $query); $rows = mysqli_fetch_assoc($result) ; $totals = mysqli_num_rows($result) ; ?> <div id="css"> <form > <table width="80%" border="0" cellpadding="2" cellspacing="2" > <caption><h2>Personal Details of Customers</h2></caption> <tr class="white"> <td bgcolor="#330033"> </td> <td bgcolor="#330033"> Id Number </td> <td bgcolor="#330033"> Full Name </td> <td bgcolor="#330033"> Email Address </td> <td bgcolor="#330033"> Website </td> <td bgcolor="#330033"> Comment </td> <td bgcolor="#330033"> Time </td> </tr> <?php while($rows=mysqli_fetch_assoc($result) { <tr> <input type="raido" name="ID" value="<?php echo $rows['ID']; ?>" /> <td bgcolor="#FFFFCC"><?php echo $rows['ID'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Name'];?> </td> <td bgcolor="#FFFFCC"><?php echo $rows['Email'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Website'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Comment'];?></td> <td bgcolor="#FFFFCC"><?php echo $rows['Time'];?></td> <td> </td> <td> <a href="delete.php? ID= "$rows[ID]" /"> <input type="submit" name="del" value="Delete" /> </a> <input type="button" name= "edit" value="Edit" /> </td> </tr> }?> </table> </form> </div> </body> |