Jump to content

sonnieboy

Members
  • Content Count

    151
  • Joined

  • Last visited

Community Reputation

0 Neutral

About sonnieboy

  • Rank
    Advanced Member

Profile Information

  • Gender
    Not Telling
  1. public function AddFiles($name = 'item') { // If the files array has been set if(isset($_FILES[$name]['name']) && !empty($_FILES[$name]['name'])) { // Remove empties $_FILES[$name]['name'] = array_filter($_FILES[$name]['name']); $_FILES[$name]['type'] = array_filter($_FILES[$name]['type']); $_FILES[$name]['size'] = array_filter($_FILES[$name]['size']); $_FILES[$name]['tmp_name'] = array_filter($_FILES[$name]['tmp_name']); // we need to differentiate our type array names $use_name = ($name == 'item')? 'Ad
  2. Of course if as suggested by others you are being hacked by your poorly written queries I just love it when some people think it makes them feel more important by putting others down.
  3. public function AddFiles($name = 'item') { // If the files array has been set if(isset($_FILES[$name]['name']) && !empty($_FILES[$name]['name'])) { // Remove empties $_FILES[$name]['name'] = array_filter($_FILES[$name]['name']); $_FILES[$name]['type'] = array_filter($_FILES[$name]['type']); $_FILES[$name]['size'] = array_filter($_FILES[$name]['size']); $_FILES[$name]['tmp_name'] = array_filter($_FILES[$name]['tmp_name']); // we need to differentiate our type array names $use_name = ($name == 'item')? 'Ad
  4. Just one question. The second code is the working version, although I wanted to make some changes to it to remove all the spouseDetails info but this forum is a bit difficult to navigate. First, it does not allow you to post your code where you want it. It pushes all codes up. Maybe I am the problem, I have not figured out to post code here and display it at top or bottom. Second issue is there is no way to go back and make changes to your own thread. I was attempting to show the code that works for just one checkbox, grid1Details and how to make it work for more than one c
  5. <script type="text/javascript"> function validate() { var checkbox = document.getElementById("<%=grid1Details.ClientID %>"); var txtsourcename = $("[id*='txtsourcename']")[0]; var txtsourceaddress = $("[id*='txtsourceaddress']")[0]; var txtsourceincome = $("[id*='txtsourceincome']")[0]; //spouse check checkbox = document.getElementById("<%=spouseDetails.ClientID%>"); var txtspousename = $("[id*='txtspousename']")[0]; var txtspouseaddress = $("[id*='txtspouseaddress']")[0]; var txtspouseincome = $("[i
  6. Pastor is the Pastor of a Ministry if I understand you correctly. So, that table is where pastor and ministry information is stored. Then there is another table stores pastor/ministry related information. So, to add information to this table, user is required to select the pastor from dropdown. Once that pastor is selected, his/her ministry is automatically selected too based on the pastor of that ministry.
  7. The user wants the value of ministryname to have its own textbox, not to part of pastorname value.
  8. Thanks a lot Barand. I actually thought about that option but then then how do I insert the value of pastorname into the database? In .NET, we would insert the textItem, in this case pastorname. What's the equivalence in php?
  9. <?php $conn=mysqli_connect("localhost","myuuser","mypass","mydb"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $select_query="Select pastorname, ministryname from xphias_clients"; $select_query = mysqli_query( $conn,$select_query); echo "<select name='pastorsname' id='pastorsname' class='form-control'>"; while ($rc= mysqli_fetch_array($select_query) ) { echo "<option value='" .$rc['pastorname'] . "'>" . $rc['pastorname'] . "</option>"; } echo "</select>"; ?></td>
  10. <?php error_reporting(E_ERROR | E_WARNING | E_PARSE); // Initialize connection to database $conn=mysqli_connect("localhost","myuser","mypass","mydb"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } function render_error($settings = array("title"=>"Failed","body"=>"Sorry, your submission failed. Please go back and fill out all required information.")) { ?> <h2><?php echo (isset($settings['title']))? $settings['title']:"Error"; ?></h2> <p><?php echo (isset($settings['body'
  11. Your solution worked perfectly,however. Thank you so very much sir
  12. <td><INPUT TYPE="TEXT" NAME="pastorsname[]" SIZE="14"></td> <td><INPUT TYPE="TEXT" NAME="ministriesname[]" SIZE="14"></td> <td><INPUT TYPE="TEXT" NAME="xstartdate[]" SIZE="10"></td> <td><INPUT TYPE="TEXT" NAME="clientname[]" SIZE="14"></td> <td><INPUT TYPE="TEXT" NAME="url[]" SIZE="14"></td> but you are suggesting to have them like below? <td><INPUT TYPE="TEXT" NAME="record[1][pastorsname]" SIZE=
  13. <?php $dbhost = "localhost"; $dbname = "mydb"; $dbusername = "xxxx"; $dbpassword = "mypass"; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $pdo = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbusername, $dbpassword); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $stmt = $pdo->prepare("INSERT INTO xphias (pastorsname, ministriesname, xstartdate,clientname, url) VALUES (?,?,?,?,?)"); for ($i = 0; $i < count($_POST['pastorsname']); $i++) { $stmt->execute(array( $pastorname = $_POST['pastorsname'][$i],
  14. This has worked. Thank you very much, I just have to add error checking and successful submission message,
×
×
  • 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.