JM25 Posted April 15, 2014 Share Posted April 15, 2014 (edited) I am writing PHP code for a database that (for this particular file) will pull up a particular item within the database with the fields first name, last name, and prayer request. The idea is that you select the item and can edit either the first name, last name, or prayer request if there was a typo, misspelled word, etc. When I click the "Approve Prayer Request Button" literally nothing happens. I also have a column titled Reg_ID which specifies which row of data you want to select to edit the information. It does not pull information from the server either, even though it did at one point. I think it is a problem with my mySQL statements but I have tried numerous things and cannot get it to work. I am wanting everything to be done within this file. Any suggestions would be GREATLY appreciated. This file is named Approve Deny Prayer Request. <?php $DB_HOST = "XXXXXXXX"; $DB_NAME = "XXXXXXXX"; $DB_PASS = "XXXXXXXX"; $DB_USER = "XXXXXXXX"; $link = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME); if($link->connect_errno > 0) { die('Connection failed [' . $db->connect_error . ']'); } $query = "SELECT * FROM Request"; $result = mysqli_query($link,$query); //<----- Added link $row = mysqli_fetch_array($result); if(isset($_POST['add'])){ $id = mysqli_real_escape_string($link,$_POST['REG_ID']); $firstname = mysqli_real_escape_string($link,$_POST['first']); $lastname = mysqli_real_escape_string($link,$_POST['last']); $phone = mysqli_real_escape_string($link,$_POST['phone']); $query2=mysqli_query($link,"UPDATE Request SET Reg_F_Name='$firstname', Reg_L_Name='$lastname',Reg_Request='$phone' WHERE id='$Reg_ID'" ); if($query2){ header("Location: fbcaltusprayerorg.ipagemysql.com"); } } // brace if(isset($_POST['add'])) ?> <form action="" method="post"> <table> <input type="hidden" name="id" value="<? echo "$row[id]" ?>"> <tr> <td>First Name:</td> <td><input type="text" name="first" value="<? echo "$row[1]" ?>"></td> </tr> <tr> <td>Last Name:</td> <td><input type="text" name="last" value="<? echo "$row[2]" ?>"></td> </tr> <tr> <td>Prayer Request:</td> <td><input type="text" name="phone" value="<? echo "$row[5]" ?>"></td> </tr> </table> <input name="add" type="submit" id="add" value="Approve Prayer Request"> </form> Edited April 15, 2014 by JM25 Quote Link to comment Share on other sites More sharing options...
MECU Posted April 15, 2014 Share Posted April 15, 2014 What browser are you using? http://stackoverflow.com/questions/415234/forms-with-action Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.