Jump to content

JM25

New Members
  • Posts

    1
  • Joined

  • Last visited

JM25's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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>
×
×
  • 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.