Jump to content
  • Who's Online   0 Members, 0 Anonymous, 319 Guests (See full list)

    • There are no registered users currently online

All Activity

This stream auto-updates

  1. Yesterday
  2. @GregRickshaw thanks alot for your feedback i am glad as my guidence solve your problem shortly Best Regard Danish hafeez | QA Assistant ICTInnovations
  3. @Barand Ok. I had initially built my form in a similar manner with the values and labels coming from an array (which I expected to eventually generate from a table) anyway. Always confuses me. I know there are advantages to PDO (which I'll likely never be ready for), but I use procedural.
  4. Last week
  5. "o" and "v" are table aliases for the option and vote tables. First I made a couple of additions to the tables... Poll table - added "polling_day" date column (so we now know the current poll when voting) Vote table - added unique index on user_id/option_id to prevent double-voting. CREATE TABLE `vote` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `option_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `unq_vote_user_opt` (`user_id`,`option_id`) ) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; CREATE TABLE `poll` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) DEFAULT NULL, `polling_day` date DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; The sample code below uses a query of the poll_option table to get the options for the current poll and generates the checkboxe for the form. The checkboxes are names "vote[]" so they are posted as an array. Note that only "checked" checkboxes are posted so you just need to loop through the array of $POST['vote'] values and insert a vote record for each (with the id of the logged-in user. CODE <?php require 'db_inc.php'; // USE YOUR OWN ... $pdo = mdbConnect('db1'); // ... CONNECTION CODE $_SESSION['user_id'] = 123; // emulate user being logged in - testing only. ################################################################################ ## Handle posted form data ################################################################################ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Use "INSERT IGNORE ... " so attemmpts to vote twice for an option are ignored $stmt = $pdo->prepare("INSERT IGNORE INTO vote(user_id, option_id) VALUES (?, ?)"); foreach ($_POST['vote'] as $oid) { $stmt->execute( [ $_SESSION['user_id'], $oid ] ); } header("Refresh: 0"); // reload form exit; } ################################################################################ ## Build arrays of vote options for the current poll ################################################################################ $res = $pdo->query("SELECT o.id, o.opt FROM poll_option o JOIN poll p ON o.poll_id = p.id WHERE p.polling_day = CURDATE() ORDER BY opt "); $options = array_column($res->fetchAll(), 'opt', 'id'); if (empty($options)) { exit ("Today is not a polling day"); } ################################################################################ ## Build check box list for the form ################################################################################ $chkboxes = ''; foreach ($options as $val => $label) { $chkboxes .= "<input type='checkbox' name='vote[]' value='$val'>&ensp;$label<br>"; } ?> <!DOCTYPE html> <html lang='en'> <head> <meta charset="utf-8"> <title>Example</title> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <style type='text/css'> </style> </head> <body> <form method='POST'> <div class='w3-margin w3-padding w3-border'> <h3>Select your preferences</h3> <?=$chkboxes?> <br> <input type='submit'> </div> </form> </body> </html>
  6. Yes I have been using that since your suggestion, it's truly amazing! Small things and all that!
  7. @Barand Got a little busy, but as always, your help is greatly appreciated. It always looks so simple when you show the path. And it seems you anticipated my next phase, which would be something along the line of "Choose 3 cities from the checkbox group that you would be most interested in visiting." If I'm understanding your example, I can easily expand the "vote" table to accept more INSERTed data with each form submission (This approach will NOT be inserting zero/null for unselected checkboxes, but without using 3 separate dropdown menus, what is the best/most correct way to format a smooth accumulation of selected itemsto be inserted into the table?) I haven't had the time to test my actual code, but it would seem modifying it to operate in a normalized methodology will be easier than jumbling through my "dog's breakfast of a table" set-up. LOL Also from your reply, you use the character "o" , but I'm not sure I'm following its origin or meaning. Can you clarify or link me to an explanation? Thanks!!
  8. and if you validate the resulting web page, you will find all the broken and obsolete markup -
  9. Hi Danish @Danishhafeez Anyway I can get the refer button on the same line? I have followed your code now
  10. Thanks @Danishhafeez got there just as you posted your reply, but thank you so much!
  11. Wow @Barand what an amazing script you have given me. I will certainly be using the code again. However I finally went with @dodgeitorelse3 solution of adding the foreach into the table (below). I knew it needed to be in there somewhere just couldn't figure it out. Thanks to all who replied it now works a treat. It's messy but it works I will look to refine it the way @Barand suggests as that seems way more controllable and repeatable. Thanks all Greg if($details) { foreach ($details as $detail) { echo "<td><left>" . $detail['fullname'] . "</td>"; echo "<td><left>" . $detail['connectionemail'] . "</td>"; echo "<td><left>" . $detail['skill'] . "</td>"; echo "<td><left>" . $detail['phonenumber'] . "</td>"; echo "<td><left>" . $detail['region'] . "</td>"; echo "<td><left>" . $detail['daysremaining'] . "</td>"; echo "<form action=LogReferal.php?email=referto>"; echo "<td><select name=referto id= referto>" ; foreach($agencies as $agencylist) { echo "<option><name=referto type=email>" . $agencylist['email'] . "</option>"; } echo "<input type=hidden name=referred value=$detail[connectionemail]>"; echo "<td><left><input type=submit value=refer></td></tr>"; } }
  12. To ensure the dropdown appears in the correct position within each row, you need to place the <select> element inside the loop that iterates over your $details array. The issue arises because the <select> element is currently being added outside the loop, which causes it to appear only once at the end of the table. Additionally, the form tags should also be inside the loop to ensure each row has its own form, dropdown, and submit button. <?php // Connection details section.. $email = current_user(); $statement = db()->prepare("EXEC fe_uspConnectionDetails ?;"); $statement->bindParam(1, $email, PDO::PARAM_STR); $statement->execute(); $details = $statement->fetchAll(PDO::FETCH_ASSOC); // Fetch agencies for dropdown $statement = db()->prepare("EXEC fe_uspAdminUserShowRegisteredAgencies"); $statement->execute(); $agencies = $statement->fetchAll(PDO::FETCH_ASSOC); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <p> <table> <thead> <tr> <th><i>name</i></th> <th><i>email</i></th> <th><i>skill</i></th> <th><i>mobile</i></th> <th><i>region</i></th> <th><i>days</i></th> <th><i><center>refer to</center></i></th> </tr> </thead> <tbody> <?php if ($details) { foreach ($details as $detail) { echo "<tr>"; echo "<td><left>" . $detail['fullname'] . "</td>"; echo "<td><left>" . $detail['connectionemail'] . "</td>"; echo "<td><left>" . $detail['skill'] . "</td>"; echo "<td><left>" . $detail['phonenumber'] . "</td>"; echo "<td><left>" . $detail['region'] . "</td>"; echo "<td><left>" . $detail['daysremaining'] . "</td>"; echo "<td><left>"; echo "<form action='LogReferal.php?email=referto' method='POST'>"; echo "<input type='hidden' name='referred' value='" . $detail['connectionemail'] . "'>"; echo "<select name='referto' id='referto'>"; foreach ($agencies as $agencylist) { echo "<option value='" . $agencylist['email'] . "'>" . $agencylist['email'] . "</option>"; } echo "</select>"; echo "<input type='submit' value='refer'>"; echo "</form>"; echo "</td>"; echo "</tr>"; } } ?> </tbody> </table> </body> </html> Data Fetching: First, fetch both the connection details and the agency list. HTML Structure: The HTML structure now includes the <select> dropdown within each row of the table. Loop and Form: The loop iterates over each $detail and adds a row in the table. The form, including the hidden input for the referred value and the dropdown for referto, is inside this loop. This ensures each row has its own form and dropdown, associated correctly with the row's data. Form Method: Ensure the form uses the POST method to securely send data. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  13. I prefer to use a function to build the options from an array (or query results), creating the html for the options and selecting the appropriate item. An example is below. DATA USED RESOURCE USER +----+--------------------+ +----+----------+--------------+ | id | description | | id | username | fullname | +----+--------------------+ +----+----------+--------------+ | 1 | Car - C43 GBT | | 1 | tess | Tess Tickell | | 2 | Van - D76 GBT | | 2 | hugh | Hugh Jass | | 3 | Minibus - MN11 BUS | | 3 | tom | Tom DiCanari | +----+--------------------+ | 4 | lucy | Lucy Lastik | | +----+----------+--------------+ | | +---------+ | | +---------------------+ | | BOOKING | | +----+-------------+---------------------+---------------------+---------+ | id | resource_id | book_start | book_end | user_id | +----+-------------+---------------------+---------------------+---------+ | 1 | 1 | 2024-05-13 09:00:00 | 2024-05-13 12:00:00 | 1 | | 2 | 1 | 2024-05-13 12:00:00 | 2024-05-13 17:00:00 | 2 | | 4 | 1 | 2024-05-16 12:00:00 | 2024-05-16 18:00:00 | 3 | | 5 | 2 | 2024-05-13 11:30:00 | 2024-05-17 18:00:00 | 4 | +----+-------------+---------------------+---------------------+---------+ OUTPUT EXAMPLE CODE EXAMPLE <?php require 'db_inc.php'; // USE YOUR OWN ... $pdo = mdbConnect('db1'); // ... CONNECTION CODE ################################################################################ ## Build arrays of dropdown options ################################################################################ $res = $pdo->query("SELECT id, description FROM resource ORDER BY description "); $results = $res->fetchAll(); $resources = array_column($results, 'description', 'id'); $res = $pdo->query("SELECT id, fullname FROM user ORDER BY fullname "); $results = $res->fetchAll(); $users = array_column($results, 'fullname', 'id'); /*************************************************************************** * function to generate menu options from array and select current value * * @param array $optArray Array of menu options * @param mixed $current Currnt value to be selected */ function menuOptions(&$optArray, $current='') { $opts = "<option value=''>- select -</option>\n"; foreach ($optArray as $val => $txt) { $sel = $val==$current ? 'selected' : ''; $opts .= "<option $sel value='$val'>$txt</option>\n"; } return $opts; } ################################################################################ ## Build html table for sreen display ################################################################################ $res = $pdo->query("SELECT b.id as bid , r.id as rid , u.id as uid , date_format(b.book_start, '%b %d - %h:%i%p') as stime , date_format(b.book_end, '%b %d - %h:%i%p') as etime FROM booking b JOIN user u ON b.user_id = u.id JOIN resource r ON b.resource_id = r.id ORDER BY rid, book_start, book_end "); $tdata = ''; foreach ($res as $r) { $tdata .= "<tr> <td>{$r['bid']}</td> <td><select name='resid'>" . menuOptions($resources, $r['rid']) . "</select></td> <td><select name='userid'>" . menuOptions($users, $r['uid']) . "</select></td> <td>{$r['stime']}</td> <td>{$r['etime']}</td> </tr> "; } ?> <!DOCTYPE html> <html lang='en'> <head> <meta charset="utf-8"> <title>Example</title> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <style type='text/css'> table { border-collapse: collapse; width: 100%; } th, td { padding: 8px; } th { border: 1px solid white; background-color: black; color: white; } </style> </head> <body> <header class='w3-indigo w3-padding'> <h1>Dropdown Menus</h1> </header> <table border='1'> <tr><th>ID</th> <th>Item</th> <th>User</th> <th>From</th> <th>Until</th> </tr> <?=$tdata?> </table> <br> <?=pdo2text($pdo, "select * from resource")?> </body> </html>
  14. Thanks guys for the recommendations. I agree with you both, it's my HTML which is too messy, I'll rebuild the table on your suggestions and see where I get. Many thanks for your guidance and advice.
  15. you can put a complete html table inside a single form and you can put a complete form inside a single table cell (th or td), but you cannot spread forms out, inside of multiple cells, in a single html table. also, all the html you are outputting inside the html table, that is not inside of a table cell is being rendered above the table. i recommend that you validate the resulting html markup at validator.w3.org either all the markup in your first example didn't get posted or it is broken and only seems to produce the correct result because there's a single form and a single table row (tr.) your second example, in addition to what @dodgeitorelse3 has posted, has no opening or closing <tr> </tr> tags, and the select tag and form tag will need to be closed in each pass through the details loop.
  16. I think your drop down needs to be inside your foreach($details as $detail)
  17. Hi all I want to display the same drop down list (selection) in every row of my table but I can't seem to work out how to do it, the drop down always seems to come at the end of the table and not on each row. The drop down list is a SQL query (a stored procedure) which is called. I managed to get the dropdown to appear in the correct place when it's just one row in a table. <?php $statement = db()->prepare("EXEC fe_uspAdminUserShowRegisteredAgencies"); $statement->execute(); $agencies= $statement->fetchAll(PDO::FETCH_ASSOC); ?> <p> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <table> <thead> <tr bgcolor="#FFF8DC"></b> <th><center><i>inviter</th> <th><center><i>inviter email</th> <th><center><i>inviter contact</th> <th><center><i>inviter region</th> <th><center><i>inviter skill</th> <th>refer to</th> <th></th> </i> </center> </tr> </thead> <p> </p> <?php if($inviterdetails) { foreach ($inviterdetails as $inviterdetail) { echo "<tr bgcolor=#FFF8DC>"; echo "<td><center>" . $inviterdetail['fullname'] . "</td>"; echo "<td><center>" . $inviterdetail['inviteremail'] . "</td>"; echo "<td><center>" . $inviterdetail['invitercontact'] . "</td>"; echo "<td><center>" . $inviterdetail['inviterregion'] . "</td>"; echo "<td><center>" . $inviterdetail['inviterskill'] . "</td>"; echo "<form action=LogReferal.php?email=referto>"; // echo "<td><left><input type=email id=referto name=referto></td>"; echo "<input type=hidden name=referred value=$inviterdetail[inviteremail]>"; echo "<td><left><input type=submit value=refer></td>"; } } ?> <td><select name="referto" id ="referto"> <?php foreach($agencies as $agencylist) { echo "<option><name=referto type=email>" . $agencylist['email'] . "</option>"; } Produces the desired result However when I try to repeat the process in a separate table which has multiple rows, I get the selection drop down all over the place in this case at the end of the row and not applicable to any particular row. I have managed to get it everywhere except on the row it should be and it doesn't repeat and be relevant to the row. <?php //Connection details section.. $email = current_user(); $statement = db()->prepare("EXEC fe_uspConnectionDetails ?;"); $statement->bindParam(1, $email, PDO::PARAM_STR); $statement->execute(); $details = $statement->fetchAll(PDO::FETCH_ASSOC); ?> <p> <p> <table> <thead> <tr> <th><i>name</th> <th><i>email</th> <th><i>skill</th> <th><i>mobile</th> <th><i>region</th> <th><i>days</th> <th><i><center>refer to</center></th> </tr> </thead> <hr color="#c7c34c" size="4" width="50%"> <p><i>my connections (below)</i></p> <?php if($details) { foreach ($details as $detail) { echo "<td><left>" . $detail['fullname'] . "</td>"; echo "<td><left>" . $detail['connectionemail'] . "</td>"; echo "<td><left>" . $detail['skill'] . "</td>"; echo "<td><left>" . $detail['phonenumber'] . "</td>"; echo "<td><left>" . $detail['region'] . "</td>"; echo "<td><left>" . $detail['daysremaining'] . "</td>"; echo "<form action=LogReferal.php?email=referto>"; // echo "<td><left><input type=email id=referto name=referto></td>"; echo "<input type=hidden name=referred value=$detail[connectionemail]>"; echo "<td><left><input type=submit value=refer></td>"; // echo "<form action=LogReferal.php?email=referto>"; // // echo "<td><left><input type=email id=referto name=referto></td>"; // echo "<input type=hidden name=referred value=$inviterdetail[inviteremail]>"; // echo "<td><left><input type=submit value=refer></td></tr></form>"; } } ?> <td><select name="referto" id ="referto"> <?php foreach($agencies as $agencylist) { echo "<option><name=referto type=email>" . $agencylist['email'] . "</option>"; } ?> </td> I kind of realise the repeating code (for each) has to be somewhere in the main table and not outside the table but I have just got stuck... Any help greatly received Cheers Greg
  18. Yes, you can achieve this by creating a single config.php file that defines the base path to your assets. Then, you can include this config.php file in all your PHP scripts to access the styles and other assets. Create the config.php file: Place this file in the TESTFOLDER directory (or any consistent location you prefer). This file will define the base path to your assets. <?php // Define the base URL to your assets define('BASE_URL', '/TESTFOLDER'); ?> Include the config.php file in your scripts: In each of your PHP scripts (index.php, dash.php, 01.php, 02.php), include the config.php file and use the BASE_URL constant to link to your assets. For example, in TESTFOLDER/module1/public/index.php: <?php // Include the config file require_once '../../config.php'; // Adjust the path as needed // Use the BASE_URL constant to link to the CSS file ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <link rel="stylesheet" href="<?php echo BASE_URL; ?>/assets/styles/style.css"> </head> <body> <!-- Your content goes here --> </body> </html> Adjust the path to config.php as necessary: Since the public folder is two levels deep inside the module1 folder, you need to navigate up two levels to include the config.php file. The ../../config.php path in the example above reflects this. Make sure to adjust this path if your structure changes or if the config.php file is located elsewhere. By using this approach, you can centralize the configuration of your asset paths, making your code cleaner and easier to maintain. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  19. Added user table and also added user_id to booking table records... USER +----+----------+--------------+ | id | username | fullname | +----+----------+--------------+ | 1 | tess | Tess Tickell | | 2 | hugh | Hugh Jass | | 3 | tom | Tom DiCanari | | 4 | lucy | Lucy Lastik | +----+----------+--------------+ BOOKING +----+-------------+---------------------+---------------------+---------+ | id | resource_id | book_start | book_end | user_id | +----+-------------+---------------------+---------------------+---------+ | 1 | 1 | 2024-05-13 09:00:00 | 2024-05-13 12:00:00 | 1 | | 2 | 1 | 2024-05-13 12:00:00 | 2024-05-13 17:00:00 | 2 | | 4 | 1 | 2024-05-16 12:00:00 | 2024-05-16 18:00:00 | 3 | | 5 | 2 | 2024-05-13 11:30:00 | 2024-05-17 18:00:00 | 4 | +----+-------------+---------------------+---------------------+---------+ I also added styles for each user name to define background colours. I used a couple of SQL WINDOW functions to the query the row_number() so I know which is the first cell of each booking (That's the only on we need to output) the row count() so we know how many rows the cell should span. CODE <?php require 'db_inc.php'; // $pdo = mdbConnect('db1'); // USER YOUR OWN CONNECTION CODE $wkcomm = $_GET['wkcomm'] ?? date('Y-m-d'); ################################################################################ ## COLUMN HEADINGS ################################################################################ $res = $pdo->query("SELECT id, description FROM resource ORDER BY id "); $theads = "<tr class='w3-dark-gray'><th>Time Slot</th>"; foreach ($res as $r) { $theads .= "<th>{$r['description']}</th>"; } $theads .= "</tr>\n"; ################################################################################ ## QUERY BOOKINGS AND BUILD ARRAY IN REQUIRED STRUCTURE FOR OUTPUT ################################################################################ $res = $pdo->prepare(" -- -- create temporary table containing the daily 30-minute timeslots -- WITH RECURSIVE timeslot (n, starttime, endtime, date) AS ( SELECT 1, '07:00:00', '07:30:00', ? UNION ALL SELECT n+1 , addtime(starttime, '00:30:00') , addtime(endtime, '00:30:00') , date FROM timeslot WHERE n < 24 ) SELECT r.id as resid , time_format(starttime, '%H:%i') as time , b.id as id , u.fullname as booked_by , u.username , t.date , t.starttime , ROW_NUMBER() OVER w1 as slotnum , COUNT(b.id) OVER w2 as slotcount -- -- cross join the resource table with temp timeslot table to give rows for every timeslot for each resource -- then match these against the bookings to see which slots fall withing the booking range -- for the matching resource -- FROM resource r CROSS JOIN timeslot t LEFT JOIN booking b ON CONCAT(t.date, ' ', t.starttime) < b.book_end AND CONCAT(t.date, ' ', t.endtime) > b.book_start AND r.id = b.resource_id LEFT JOIN user u ON b.user_id = u.id WINDOW w1 AS (PARTITION BY id, t.date ORDER BY t.starttime) , w2 AS (PARTITION BY id, t.date) ORDER BY starttime, resid "); $res->execute([ $wkcomm ]); $data = []; foreach ($res as $r) { $data[$r['time']][$r['resid']] = ['bid' => $r['id'], 'num' => $r['slotnum'], 'span' => $r['slotcount'], 'cust' => $r['booked_by'], 'class' => $r['username'] ]; } ################################################################################ ## LOOP THROUGH ARRAY TO CREATE HTML ROWS ################################################################################ $tdata = ''; foreach ($data as $tslot => $slotdata) { $tdata .= "<tr><td class='w3-gray w3-text-white'>$tslot</td>"; foreach ($slotdata as $booked) { if ($booked['bid']) { if ($booked['num']==1) { $tdata .= "<td class='booked {$booked['class']}' rowspan='{$booked['span']}'>{$booked['cust']}</td>"; } } else { $tdata .= '<td>&nbsp;</td>'; } } $tdata .= "</tr>\n"; } ?> <!DOCTYPE html> <html lang='en'> <head> <meta charset="utf-8"> <title>Example</title> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> <style type='text/css'> table { border-collapse: collapse; width: 100%; } th, td { padding: 4px; } th { border: 1px solid white; } .booked { color: white; border: 3px solid #E0E0E0; text-align: center; } .tess { background-color: #A91723; } .hugh { background-color: #54BC54; } .tom { background-color: #EC9807; } .lucy { background-color: #8F1FCF; } </style> </head> <body> <header class='w3-indigo w3-padding'> <h1>Resource Bookings</h1> </header> <form class='w3-light-gray w3-padding w3-margin-bottom'> Date: <input type='date' name='wkcomm' value='<?=$wkcomm?>'> &emsp; <button class='w3-blue w3-button'>Refresh</button> </form> <div class='w3-content'> <table class='w3-small' border='1'> <?=$theads?> <?=$tdata?> </table> </div> </body> </html>
  20. i have created config.inc.php in root and include that file along with header / css / js include files. In config.inc.php for local development i use $_SERVER['DOCUMENT_ROOT'] which is returning correct path and on server i use getcwd(); which is returning path to public_html
  21. This framework is superb and adaptable i've managed to make some tweaks. relatively easy thanks to your hard work. I think there is just two things that would finish it for our volunteer group:- Ability to span rows for a booked so details of the booking could be shown - Extend the booking Table to show who booked it Ability to change colour of booking either for the car/van or the user who booked the vehicle I do appreciate these are user tweaks but the ability to expand the booking red to be on block and put the text of the booking details would make it so visual for the users.
  22. Hey Everyone, I am hoping to find a framework that can easily do the following: 1. Take the information I feed it, and turn it into a simple form that can store and validate entries into a MYSQL Database 2. Use entries from one table as drop-down options for another 3. Allow me to search the database and display them easily. I originally used Google Sheets for it, but I'm finding that is going to be a lot of work. I attached screenshots of the documents to give an idea of what the functionality is going to be I know none of this is hard to do. I don't want to go through the trouble of making a front-end, and troubleshooting if there is a faster way.
  23. if $_SERVER['DOCUMENT_ROOT'] doesn't contain the correct value to the (public) document root folder and you cannot correct the server configuration so that it does, you can simply set it to the value you want (it's just a variable) in a common configuration .php file that you require (you should use require for things you code must have) at the start of your code.
  24. Dear Danish Hafeez Thank you for your reply, what you have suggested is working fine in normal folder structure. I might be wrong with folder structure, my folder structure looks like this TESTFOLDER/assets/styles/style.css TESTFOLDER/includes TESTFOLDER/dist TESTFOLDER/fonts TESTFOLDER/js TESTFOLDER/module1/models TESTFOLDER/module1/views TESTFOLDER/module1/contrls TESTFOLDER/module1/public What i am trying to do is to access TESTFOLDER/assets/styles/style.css inside TESTFOLDER/module1/public/index.php TESTFOLDER/module1/public/dash.php TESTFOLDER/module1/public/01.php TESTFOLDER/module1/public/02.php is it possible to do it with single file named config.php and call it on all module folders
  25. Thank you, thank you, thank you! You fixed it. Attachment being sent and received. And yes, I will use PHPmailer for my next project, if needed. Ray
  26. The point of a library like PHPMailer isn't so that you don't know what's going on. It's so that you don't have to worry about details - as you put it, so you can "get this to work". Because here are the lines where you're doing something wrong: $eol = PHP_EOL; $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\""; $header .= "--".$uid.$eol; $header .= "Content-type:text/plain; charset=iso-8859-1.".$eol; $header .= "Content-Transfer-Encoding: 8bit".$eol.$eol; $message .= "Content-Disposition: attachment; filename=\"".$filename."\"".$eol; But it's sure not obvious what's wrong about them, right? Switch to PHPMailer or SwiftMailer or some other standard library so you can get this problem resolved quickly and move onto the next one.
  1. Load more activity
×
×
  • 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.