PHP - Issues With Using A Echo Output As An Hyperlink.
What I have been attempting to do with no luck is utilize <?php echo $row_DetailRS1['NSN']; ?> as a hyperlink. The Hyperlink will point to another website http://www.logisticsinformationservice.dla.mil/webflis/pub/pub_search.aspx?niin=+++++++++++++ The 13 + signs would be populated with the 13 digit that is returned from <?php $info=$row_DetailRS1['NSN']; ?> Below is the complete code as it stands how. Any assistance with making this work is greatly appreciated.
<A HERF="http://www.logisticsinformationservice.dla.mil/webflis/pub/pub_search.aspx?niin=<?php $info=$row_DetailRS1['NSN']; ?>"><?php echo $row_DetailRS1['NSN']; ?></A> One additional question. If I want a new page to open when the hyperlink is clicked would I add &newpage=1 to the end of the URL? Similar TutorialsHi there, im trying to echo a hyperlink and parse a url parameter. Its not quite working as iam getting T-string error. If someone with fresh eyes could quickly glance for me that would be ace. Code: [Select] <?php if ($row_ship['PlayerName'] == '$_SESSION['MM_Username']'){ echo '<a href="ship_edit.php?recordID='.$row_Ship['ShipID'].'">Edit</a>';} ?> Thank You Hi there im trying to parse a url parameter in a hyperlink, i cant seem to get it to work, im sure its a problem with the braces. This is the original code: Code: [Select] echo '<a href="http://localhost/swb/planet.php/"> <p class="rmoncalamari tmoncalamari">' . $moncalamari. "1-1-2-6".'</p></a>'; and i tried to modify it to parse the record id... Code: [Select] echo '<a href="http://localhost/swb/planet.php?recordID= '$row_cats['CatName'];/"> <p class="rmoncalamari tmoncalamari">' . $moncalamari. "1-1-2-6".'</p></a>'; If you could help me that would be ace. Thank you Hi all i m using DOM code to strip the inline styles. The problem is that when i "view source" my code in browser then i see 2 <html>tags and 2<doctype> tags starting <?php require_once("config.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> here is the second doctyle starts <? $html = '<table> <tbody> <tr style="PADDING-BOTTOM: 0px; BORDER-RIGHT-WIDTH: 0px;"> <td style="BACKGROUND-IMAGE: none; BORDER-BOTTOM: rgb(240,240,240) 1px solid;">2G Network</td> <td style="BACKGROUND-COLOR: rgb(250,250,250); MARGIN: 0px;">GSM 850 / 900 / 1800 / 1900</td> </tr> </tbody> </table>'; $doc = new DOMDocument(); $doc->loadHTML($html); $search = new DOMXPath($doc); $results = $search->evaluate('//*[@style]'); foreach ($results as $result) $result->removeAttribute('style'); $newhtml = $doc->saveHTML(); echo $newhtml; ?> </body> </html> This is the view source from browser Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> here is the second doctyle starts <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><table><tbody><tr> <td>2G Network</td> <td>GSM 850 / 900 / 1800 / 1900</td> </tr></tbody></table></body></html> </body> </html> so can anyone tell me how to use and echo result from DOM but with validated html Vineet Hi
Using: echo $row['columnname'];
How can I strip off data from the above echo? The column always begins with 'Local/' then 3 digits then other unwanted data, lke 'Local/567@context-0000461d;1'.
It would be ideal to just display '567'.
hi there, the code below is suppose to display something like the attachement "code2" but instead it displays something like attachement "code1" please assist in find what is wrong with my echo lines.
<?php $counter = 2; $sqlq="select * from state WHERE status = 0 "; $categorysqlq = mysql_query($sqlq); $varq = mysql_num_rows($categorysqlq); while($catfetchq = mysql_fetch_array($categorysqlq)) { $cnty = $catfetchq[0]; $sqllq="select * from vehicle WHERE country = '$cnty' "; $categorysqllq = mysql_query($sqllq); $numsql = "select * from branchaddr WHERE state = '$cnty' "; $numquery = mysql_query($numsql); $varqa = mysql_num_rows($numquery); $cntyfetchq= mysql_fetch_array($numquery); if($varq != 0){ if($counter == 2){ echo "<tr><td><a href=\"transport2.php?id=".$cntyfetchq['state'].">".$catfetchq[1]."(<span style=\"color:red\">".$varqa."</span>)</a></td>"; $counter--; } else{ echo "<td><a href=\"transport2.php?id=".$cntyfetchq['state'].">".$catfetchq[1]."(<span style=\"color:red\">".$varqa."</span>)</a></td></tr>"; $counter = 2; } } } ?>Attached Files code1.png 12.65KB 0 downloads code2.png 25.34KB 0 downloads Hello, I'm creating a pretty simple user registration script. The user fills out 5 forms, submits, and if the data is valid he will be redirected to a verify script. Now I have a bit of an issue, I want to send an verification e-mail to the users e-mail address with a verification code before redirecting him to the verify page. The thing is that I've redirecting him within the header, which doesn't allow me to output the verification email. Is there any easy way around this? Regards Here's the code, this is the PHP in my html contacts page (that IS in fact saved with a PHP extension): <div class = "centercontainer"> OK, have no idea what's going on... I've done this a million times... why wont this output!?? I must have a major brain meltdown and dont know it yet!!! Code: [Select] <?php // this echoes just fine: echo $_POST['testfield']; // but this wont echo: echo if (isset($_POST['testfield'])) { $_POST['testfield'] = $test; } echo $test; /// or even this DOESNT echo either!: $_POST['testfield'] = $test; echo $test; ?> Well I have a script that executes a scan on a system set to run infinitely, and I need it to echo out a message each time it loops through, but I don't want it to echo out the message with the next loop message below it, and the next one below that etc... I've tried using the flush(); function and been messing around with that with no luck. For security reasons I don't want to release any of the processing code, but here is the basic construction of the script: <?PHP ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** $RepeatIt = -1; for($g=1; $g!=$RepeatIt+1; $g++) { ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** $ScanMessage = ":.:.: SCANNING THE HITLIST FOR MOBSTER: ".$MobName." (SCAN #$g) :.:.:"."<br/><br/>"; echo $ScanMessage; ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** ***PROCESSING AND SCAN CODE*** } ?> At the moment it's returning: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #1) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #2) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #3) :.:.: :.:.: SCANNING THE HITLIST FOR MOBSTER: DEUS EX DESTROYER (SCAN #4) :.:.: So what I want it to do is just delete the scanning message and replace it with the next scan message so while running this script you would see just the number increment on the same line. Any suggestions? Thanks. Hi All, I'm trying to echo the response from an SLA query, the query works and returns the data when I test it on an SQL application.. but when I run it on my webpage it won't echo the result. Please help? <?php $mysqli = mysqli_connect("removed", "removed", "removed", "removed"); $sql = "SELECT posts.message FROM posts INNER JOIN threads ON posts.pid=threads.firstpost WHERE threads.firstpost='1'"; $result = mysqli_query($mysqli, $sql); echo {$result['message']}; ?> I have a log system that allows 10 logs on each side(Left and right). I am trying to make it so that the left side has the 10 most recent logs, then the right as the next 10. Any ideas? So I need to echo a row from my database with php, but where i need to echo is already inside an echo. This is my part of my code: $con = mysql_connect("$host","$username","$password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("main", $con); $result = mysql_query("SELECT * FROM Vendor"); while($row = mysql_fetch_array($result)) { //I need to echo right here .................. but I get a blank page when I try this. Please Help. echo '<option value=$row['vendor_id']>'; echo $row['vendor_id']; echo '</option>'; } mysql_close($con); Result: A Blank page. Thanks in advance! Hi
I try to echo out random lines of a html file and want after submit password to whole content of the same html file. I have two Problems.
1st Problem When I echo out the random lines of the html file I don't get just the text but the code of the html file as well. I don't want that. I just want the text. How to do that?
for($x = 1;$x<=40;$x++) { $lines = file("$filename.html"); echo $lines[rand(0, count($lines)-1)]."<br>"; }I tried instead of "file("$filename.html");" "readfile("$filename.html");" But then I get the random lines plus the whole content. Is there anything else I can use instead of file so that I get the random lines of text without the html code?P.S file_get_contents doesn't work either have tried that one. 2nd Problem: As you could see in my first problem I have a file called $filename.html. After I submit the value of a password I want the whole content. But it is like the program did forget what $filename.html is. How can I make the program remember what $filename.html is? Or with other words how to get the whole content of the html file? My code: if($_POST['submitPasswordIT']){ if ($_POST['passIT']== $password ){ $my_file = file_get_contents("$filename.html"); echo $my_file; } else{ echo "You entered wrong password"; } }If the password isn't correct I get: You entered wrong password. If the password is correct I get nothing. I probably need to create a path to the file "$filename.html", but I don't know exactly how to do that. Hey guys Just a quick question: How to embed hyperlink into a database cell? Basically I echo out a table on the user interface of my site and there's an URL in one of the cells I want the user to access it by clicking on it, without copying and pasting the URL into the URL bar of the browser I tried updating the cell in phpmyadmin using <a href = http://www.example.com>http://www.example.com</a> but didn't work out, the resulting cell only had the text format Any help would be appreciated Thanks. I am having problems with a line of code. This is what I have so far. I am missing a "," according to my error message. Im trading in deep water with this line of code. I am trying to use the data from my echo state to be a hyperlink... If that makes sense. Code: [Select] echo "\t" . '<td><a href="' . APP_ROOT . 'onlinebanking/viewtransactions.php">. $account['BankAccountID'] . </a>' '</td>' . "\n"; Hello Everyone. Im new here, but hopefully you can help me I have designed a CMS using PHP and MySQL. Its fairly basic, I'll talk you thorugh the stages: 1.) The user inputs their product information into a form and the script uploads it to the database giving it a unique ID. 2.) The user is then asked to upload a big image for that product, the image is added to a folder on the server. 3.) Now the user must choose a thumbnail and it uploads in the same manner. My problem is linking the two together... So far I have this: <?php $images = "products/"; $big = "big/"; $cols = 2; if ($handle = opendir($images)) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != ".." && $file != rtrim($big,"/")) { $files[] = $file; } } closedir($handle); } $colCtr = 0; echo '<table width="212" cellpadding="2"><tr>'; foreach($files as $file) { if($colCtr %$cols == 0) echo '</tr><tr><td colspan="2"></td></tr><tr>'; echo '<td wdith=50% align="center"><a href="' . $images . $big . $file . '"><img border="0" class="gradualfader" src="' . $images . $file . '" /></a></td>'; $colCtr++; } echo '</table>' . "\r\n"; ?> This displays a lovely list of thumbnails, which when clicked opens the larger image. What i would like to do is insert a "ID" for each image so the product data can be grabbed from the database ? I think i've explained this well enough? reply if not and illl try and add more detail. To see it in action you can go to http://design.surreylabs.co.uk/parliament/2/products.php Thanks in Advance! I am using xampp. <a href="/">Home Page</a>The above code (when clicked in browser) takes me to the localhost instead of localhost/website How can i clear this issue? I have searched this forum and haven't found a solution to my question. please don't flame... I am trying to send a table field from one page to another. the field i'm sending is id. I have managed to populate the field updateplayer.php?id=***** now i have a syntax error trying to get the field to show up on the update player form. Parse error: syntax error, unexpected T_VARIABLE in /home/netman13/public_html/bccsl.org/managers/updateplayer.php on line 7 The id field is supposed to get the id variable from the previous page ?id=***** Here is the update player code: Code: [Select] <?php include 'dbc.php'; $qP = "SELECT * FROM players WHERE id = '$_GET['$id']' "; $rsP = mysql_query($qP); $row = mysql_fetch_array($rsP); extract($row); $id = trim($id); $first = trim($first); $last = trim($last); $address = trim($address); $city = trim($city); $postal = trim($postal); $phone = trim($phone); $feet = trim($feet); $inches = trim($inches); $weight = trim($weight); $birth = trim($birth); $status = trim($status); $number = trim($number); mysql_close(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Update Player</title> <link href="styles.css" rel="stylesheet" type="text/css"> <script language="JavaScript" type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script language="JavaScript" type="text/javascript" src="js/jquery.validate.js"></script> <script> $(document).ready(function(){ $.validator.addMethod("username", function(value, element) { return this.optional(element) || /^[a-z0-9\_]+$/i.test(value); }, "Username must contain only letters, numbers, or underscore."); $("#regForm").validate(); }); </script> </head> <body> <script language="JavaScript"> <!-- /*********************************************** * Required field(s) validation v1.10- By NavSurf * Visit Nav Surf at http://navsurf.com * Visit http://www.dynamicdrive.com/ for full source code ***********************************************/ function formCheck(formobj){ // Enter name of mandatory fields var fieldRequired = Array("first", "last", "address", "city", "postal", "phone", "hft", "hinch", "weight", "birthdate", "status"); // Enter field description to appear in the dialog box var fieldDescription = Array("First Name", "Last Name", "Address", "City", "Postal Code", "Phone Number", "Feet", "Inches", "Weight", "Birthdate YYYY/MM/DD", "Player Status"); // dialog message var alertMsg = "Please complete the following fields:\n"; var l_Msg = alertMsg.length; for (var i = 0; i < fieldRequired.length; i++){ var obj = formobj.elements[fieldRequired[i]]; if (obj){ switch(obj.type){ case "select-one": if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "select-multiple": if (obj.selectedIndex == -1){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "text": case "textarea": if (obj.value == "" || obj.value == null){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; default: } if (obj.type == undefined){ var blnchecked = false; for (var j = 0; j < obj.length; j++){ if (obj[j].checked){ blnchecked = true; } } if (!blnchecked){ alertMsg += " - " + fieldDescription[i] + "\n"; } } } } if (alertMsg.length == l_Msg){ return true; }else{ alert(alertMsg); return false; } } // --> </script> <table width="100%" border="0" cellpadding="5" cellspacing="0"class="main" > <tr> <td colspan="1"><p></p></td> </tr> <tr> <td width="17%"><? //Call Menu include 'menu.php'; ?></td> <td width="3%"> </td> <td width="80%"><p align="center">Update Player Information</p> <p align="center"><? if (isset($_GET['msg'])) { echo "<div class=\"msg\">$_GET[msg]</div>"; } ?></p> <p align="center"> </p> <form action="playerupdate.php" method="post" enctype="multipart/form-data" name="form" id="form" onsubmit="return formCheck(this);"> <table width="653" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="148" height="29">First Name</td> <td width="153"><label> <input name="first" type="text" disabled="disabled" class="required" id="first" value="<?=$first ?>" /> </label></td> <td width="91" height="30">Last Name</td> <td width="261"><label> <input name="last" type="text" class="required" id="last" value="<?=$last ?>" readonly="readonly" /> </label></td> </tr> <tr> <td height="30">Address</td> <td><input name="address" type="text" class="required" id="address" value="<?=$address ?>" /></td> <td>City</td> <td><label> <input name="city" type="text" class="required" id="city" value="<?=$city ?>" /> </label></td> </tr> <tr> <td height="28">Postal Code</td> <td><label> <input name="postal" type="text" class="required" id="postal" value="<?=$postal ?>" size="12" /> </label></td> <td>Phone Number</td> <td><label> <input name="phone" type="text" class="required" id="phone" value="<?=$phone ?>" size="13" /> </label></td> </tr> <tr> <td height="29">Height <strong>(ft / in)</strong></td> <td><label> <input name="feet" type="text" class="required" id="feet" value="<?=$feet ?>" size="3" /> / <input name="inches" type="text" class="required" id="inches" value="<?=$inches ?>" size="3" /> </label></td> <td>Weight (lbs)</td> <td><input name="weight" type="text" class="required" id="weight" value="<?=$weight ?>" size="5" /></td> </tr> <tr> <td height="35">Birthdate <strong>(yyyy/mm/dd)</strong></td> <td><label> <input name="birth" type="text" class="required" id="birth" value="<?=$birth ?>" size="13" readonly="readonly" /> </label></td> <td><label>Player Type:</label></td> <td><p> <label> <input name="status" type="radio" id="type_0" value="1" checked="checked" /> Church</label> <br /> <label> <input type="radio" name="status" value="2" id="type_1" /> Import</label> <br /> <label> <input type="radio" name="status" value="3" id="type_2" /> Witness</label> <br /> </p> <label></label></td> </tr> <tr> <td height="35">Player ID:</td> <td><input name="id" type="text" id="id" value="<?=$id ?>" readonly="readonly" /></td> <td>Player Number:</td> <td><input name="number" type="text" class="required" id="number" value="<?=$number ?>" size="5" /></td> </tr> <tr> <td height="29"> </td> <td><label></label></td> <td><p> <input name="teamid" type="hidden" id="teamid" value="<? echo $_SESSION['teamid'];?>" /> <input name="division" type="hidden" id="division" value="<? echo $_SESSION['divisionid'];?>" /> <input type="hidden" name="currentdate" size=11 > </p> <p> <input name="teamname" type="hidden" id="teamname" value="<? echo $_SESSION['team_name'];?>" /> </p> <p> <script> /*Current date in form credit: JavaScript Kit (www.javascriptkit.com) Over 200+ free scripts here! */ var mydate=new Date() var theyear=mydate.getYear() if (theyear < 1000) theyear+=1900 var theday=mydate.getDay() var themonth=mydate.getMonth()+1 if (themonth<10) themonth="0"+themonth var theday=mydate.getDate() if (theday<10) theday="0"+theday //////EDIT below three variable to customize the format of the date///// var displayfirst=theyear var displaysecond=themonth var displaythird=theday //////////////////////////////////// document.form.currentdate.value=displayfirst+"/"+displaysecond+"/"+displaythird </script> <input name="approved" type="hidden" id="approved" value="0" /> </p></td> <td> </td> </tr> </table> <p align="center"> <label> <input type="submit" name="submit2" id="submit2" value="Submit" /> </label> <label> <input type="reset" name="reset2" id="reset2" value="Clear" /> </label> </p> </form> <p align="center"> </p> <p align="center"> <label></label> </p></td> </tr> <tr> <td colspan="3"> </td> </tr> </table> <p> </p> </body> </html> Thanks for your help. This forum has been an awesome resource for me. Hello im wondering how i can make a hyperlinks adress be a set after a variable. this is my php: $result1 = mysql_query("SELECT id, namn, url FROM stuff ORDER BY id desc limit 1;"); $result2 = mysql_query("SELECT id, namn, url FROM stuff ORDER BY id desc limit 1,1;"); <html> <a href="???"> <p class="note-general"> The first link </p> <a href="???"> <p class="note-general"> The the second link </p> </html> The important thing is that the url from $result1 will link under "the first link" and url from $result2 link under "the second link". |