[Solved] How can i generate an excel file and save it into the local directory and send it with a mail as an attachment using phpmailer [closed]

include ‘connection.php’; include ‘phpmailer/PHPMailerAutoload.php’; $name=$_POST[‘details’]; $location=$_POST[‘from’]; $city=$_POST[‘to’]; $state=$_POST[‘message’]; $branch=$_POST[‘client’]; $email=$_POST[’email’]; $date=date(‘Y-m-d’); $columnHeader=””; $columnHeader = “Details” . “\t” .”From Date” . “\t”. “To Date” . “\t”. “Message” . “\t”. “Hotel” . “\t” . “Email” . “\t” . “Date” ; $setData=””; $newarray = array(‘details’=>$name,’fromdate’=>$location,’todate’=>$city,’message’=>$state,’hotel’=>$branch,’email’=>$email,’date’=>$date); $rowData=””; foreach ($newarray as $value) { $value=””” . $value . ‘”‘ . “\t”; … Read more

[Solved] Ajax is not sending data to PHP

First of all: var username = $(“username”).val(); var password = $(“password”).val(); Should be: var username = $(“#username”).val(); var password = $(“#password”).val(); data: “email=”+email+”&username=”+username+”&password=”+password Should be: data: {email: email, “username”: username, password: password} And $username $_POST[“username”]; $password $_POST[“username”]; Should be: $username = $_POST[“username”]; $password = $_POST[“password”]; 1 solved Ajax is not sending data to PHP

[Solved] Implementation of Nearby Person on web page [closed]

An implementation could be something like this: <?php $people = [ ‘John’, ‘Adam’, ‘Terry’, ‘Gary’, ‘Wilbur’ ]; $get_closest = function ($person) use ($people) { $closest = []; $key = array_search($person, $people); if($key !== false) { $before = $key-1; $after = $key+1; if(isset($people[$before])) $closest[] = $people[$before]; if(isset($people[$after])) $closest[] = $people[$after]; } return $closest; }; var_dump($get_closest(‘Gary’)); Output: … Read more

[Solved] I want to add text field in html dynamically using jquery or javascript to a particular button [closed]

i am showing you in javascript. First make your html file look like this <div class=”rButtons”> <input type=”radio” name=”numbers” value=”10″ onclick=”uncheck();” />10 <input type=”radio” name=”numbers” value=”20″ onclick=”uncheck();” />20 <input type=”radio” name=”numbers” value=”other” onclick=”check(this);”/>other <input type=”text” id=”other_field” name=”other_field” onblur=”checktext(this);”/> </div> In the second step write this css code to initially set the text field invisible. <style … Read more

[Solved] PHP: Array key-value, how to show value by key?

<?php $MyArray = array(‘[email protected]’ => array(‘domain.de’,’domain.org’,’domain.eu’),’[email protected]’ => array(‘domain.net’)); foreach ($MyArray as $key => $value) { echo $key . ‘ has ‘. implode(‘, ‘, $value).'<br>’; } ?> output [email protected] has domain.de, domain.org, domain.eu [email protected] has domain.net 1 solved PHP: Array key-value, how to show value by key?

[Solved] Simple PHP Error [closed]

You can only access one element at a time in an array. Change your code to something like $username = $_POST[‘username’]; $bio = $_POST[‘bio’]; $service = $_POST[‘service’]; $age = $_POST[‘age’]; if (empty($username) || empty($bio) || empty($service) || empty($age)) { echo “You forgot to fill in a field.”; } else echo “Passed.”; 6 solved Simple PHP … Read more

[Solved] How to allow specific values in my string [duplicate]

You can use preg_replace to remove all special characters from your string. Example echo $text= str_replace(‘ ‘,’|’, preg_replace(‘/[^A-Za-z0-9 ]/’, ”,”This is some $123 Money”)); Output This|is|some|123|Money solved How to allow specific values in my string [duplicate]

[Solved] Populate second select list based on first select list value [duplicate]

you have to get the choice from the url by GET method. <?php include “../areashoppers/includes/cs_functions.php”; $choice = $_GET[‘choice’]; $sql = “SELECT distinct town FROM oic_areas_full WHERE region=’$choice’ ORDER BY town ASC”; $st = $sc_conn->query($sql); while ($r = $st->fetch()) { echo “<option>” . $r[‘town’] . “</option>”; } ?> 3 solved Populate second select list based on … Read more

[Solved] Perl to PHP equivalent: extract strings with regex

This code will do as you ask. It uses preg_match_all as simbabque described <?php $html=”<tr class=”aaa”><td class=”bbb”>221.86.2.163</td><td>443</td><td><div><span class=”ccc”></span> example <span> example</span></div></td></tr><tr class=”aaa”><td class=”bbb”>221.86.2.163</td><td>443</td><td><div><span class=”ccc”></span> example <span> example</span></div></td></tr>”; preg_match_all(‘|td class=”bbb”>([\d.]+)</td><td>(\d+)</td>|’, $html, $out, PREG_SET_ORDER); foreach ( $out as $item ) { echo “$item[1]:$item[2]\n”; } ?> output 221.86.2.163:443 221.86.2.163:443 9 solved Perl to PHP equivalent: extract strings with … Read more