[Solved] Convert specific eregi_replace to preg_replace function [closed]

[ad_1] But to help. Just add delimeters to the begining and end of the pattern, I used # and escape any delimiters that are in the pattern with \ so the engine knows its not a delimeter, so \#: $sText = preg_replace(‘#(((f|ht){1}tp://)[-a-zA-Z0-9@:%_+.~\#?&//=]+)#’, ‘<a href=”https://stackoverflow.com/questions/19717752/” target=”_blank”><font color=”black”>\1</font></a>’, $sText); 3 [ad_2] solved Convert specific eregi_replace to preg_replace … Read more

[Solved] Retain Checked the checkbox inside While

[ad_1] refer to in_array <?php if(isset($_GET[“poscon”])) { $_SESSION[“poscon”] = $_GET[“poscon”]; $dr=$_SESSION[‘poscon’]; if(isset($_POST[‘submit’])) { if(!empty($_GET[‘poscon’])) $_SESSION[‘poscon’] = $_POST[‘poscon’]; $part=$_GET[“poscon”]; } $poscon=mysqli_real_escape_string($link,$_GET[‘poscon’]); $p = mysqli_query($link,”select distinct PossibleCondition,Symptoms from healthguide where Subpart like ‘%$poscon%’ and PossibleCondition REGEXP ‘^[N-Z].*$’ Order by PossibleCondition “); while($r=mysqli_fetch_array($p)) { $pc=$r[“PossibleCondition”]; $sym=$r[“Symptoms”]; if(isset($_POST) && isset($_POST[‘poscon’]) && in_array($pc,$_POST[‘poscon’])) $strIsChecked=’checked=”checked”‘; else $strIsChecked=null; echo ‘<tr>’; echo ‘<td><input … Read more

[Solved] Get Session ID of a link and produce Dynamic page PHP [closed]

[ad_1] Then add this code on your so called something.php 1)Link 1 <a href=”https://stackoverflow.com/questions/16559631/xxx.php?link=1>Link 1 </a> 2) Link 2 <a href=”xxx.php?link=2>Link 2 </a> Then on xxx.php do this <?php if ($_GET[‘link’] == “1”) { echo “hello”; } if ($_GET[‘link’] == “2”) { echo “hi”; } ?> 2 [ad_2] solved Get Session ID of a link … Read more

[Solved] How to get text input and paste it in front of a link using PHP?

[ad_1] <form action=”THE PAGE YOU SENT REQUEST” method=”POST”> <input placeholder=”zoeken” name=”zoaken” type=”text”> <input type=”submit” value=”Submit”> </form> <?php /* Get the text input with $_POST */ $string = $_POST[‘zoaken’]; /* Redirect the page to the new address */ header(‘Location: https://nl.wikipedia.org/wiki/’.$string); You should also check if the text is null, empty or has vulnerability. 0 [ad_2] solved … Read more

[Solved] Format and display array php [closed]

[ad_1] You’ve said that putting a nested foreach didn’t work, but I can’t see why it wouldn’t? Try the following code: foreach($results as $country => $shorts) { //Echo the country name echo $country . “<br />”; foreach( $shorts as $short=>$values ){ //Print all the values for that country foreach( $values as $key=>$value ){ echo $value … Read more

[Solved] PHP printf adds something after formatted string

[ad_1] I got it. I wrote: echo printf(…); instead of just: printf(…); After string produced by printf() i got that string length, which is value returned by printf (in fact – added number was 9 in case of 123.45 value, in 20.4 case it was number 8). 2 [ad_2] solved PHP printf adds something after … Read more

[Solved] How to get a Facebook user’s profile picture in php

[ad_1] To show image in page <img src=”https://graph.facebook.com/{{fid}}/picture”> To save $image = file_get_contents(‘https://graph.facebook.com/’.$fid.’/picture?type=large’); $dir = dirname(__file__).’/avatar/’.$fid.’.jpg’; file_put_contents($dir, $image); Facebook Graph API http://graph.facebook.com/abdulla.nilam/picture 1 [ad_2] solved How to get a Facebook user’s profile picture in php

[Solved] Php Login issue [closed]

[ad_1] So many thing are wrong here Replace if (isset ( $_POST [‘action’] ) && isset ( $_POST [‘action’] ) == ‘Log In’) { With if (isset ( $_POST [‘action’] ) && $_POST [‘action’] == ‘Log In’) { Too many things to replace .. hold on while i rewrite the script for you Edit 1 … Read more

[Solved] Calling a php script at the end of a js script

[ad_1] You should submit the form. (or use JavaScript to valid the form then submit it) <form id=”email_form”> <input name=”name”> <input type=”submit” id=”submit_btn”> </form> Then mail.php will get the information, and you can do whatever you want there. ADDED To submit a form in JavaScript: document.querySelector(“#submit_btn”).addEventListener(“click”,function(e){ var form = document.querySelector(“#email_form”); //Select the form form.submit(); //Submit … Read more

[Solved] How to increase the paper size as per my image size using FPDF-php?

[ad_1] I got it by adding my image into a cell like below require(‘lib/fpdf.php’); $image = MEDIA_DIR.”uploads/pdf_images/”.$report_img.”.png”; list($width, $height, $type, $attr) = getimagesize($image); $pdf = new FPDF(); $pdf->SetSize(($width/2)+110,($height*57/100)); //Custom function $pdf->AddPage(”,’custom’); $pdf->cell(1000,1000,”,$pdf->Image($image,10,10,235,$height*18/100),’PNG’); $pdf->Output(); Add the below function to fpdf.php function SetSize($width,$height) { $this->StdPageSizes[‘custom’]=array($width,$height); } [ad_2] solved How to increase the paper size as per my … Read more