PHP - Help With Fancybox Function To Allow Adding A Hypertext Link
Hi,
I am using fancybox on my site and the function I am using to display the title and data-caption is this.
$(document).ready(function() { $('.fancybox').fancybox({ beforeShow : function(){ this.title = this.title +"<br>" + $(this.element).data("caption"); } }); }); // readyI would like to change this so that I can add a hypertext link. Here is what a sample of the HTML looks like: <img src="img/portfolio/GSI_web.png" height="194" width="400" alt="Globalsoftwareinc.com" /> <h4>www.globalsoftwareinc.com</h4> <div class="portfolio-desc align-center"> <div class="folio-info"> <h5><a title="globalsoftwareinc.com" href="#" title="www.globalsoftwareinc.com">Globalsoftwareinc.com</a></h5> <a title="Global Software Inc. website" href="img/portfolio/GSI_web_large.png" class="fancybox" data-caption="I was the interactive web designer at Global Software, Inc. and assisted in the re-design and development of Global Software, Inc. in Drupal<br>www.globalsoftwareinc.com"><i class="fa fa-plus fa-2x"></i></a> </div> </div> </div> </article>so for example I would want to make www.globalsoftwareinc a hyperlink and that isn't do-able currently. It breaks the code. thanks in advance! Similar TutorialsHey guys, Been working on a project but only recently started using php. What happens is.... I have a general quiz split accross a multipage form and then a results section. The problem is, is that when it comes to if statements on the last page and deciding the difficulty level for the users quiz, it wont let me add the 3rd and final link. Here is the code to explain. I have put bits in bold and a comment. (at the bottom section) I've tried everything, Thanks for any help in advance guys. Code: [Select] <?php session_start(); $_SESSION['q11'] = $_POST['q11']; $_SESSION['q12'] = $_POST['q12']; $_SESSION['q13'] = $_POST['q13']; $_SESSION['q14'] = $_POST['q14']; $_SESSION['q15'] = $_POST['q15']; $protectscore = 0; //initialize score to zero $detectscore = 0; $resolvescore = 0; $overallScore = 0; ?> <html> <head> <title>Results</title> <h1>Protection Section</h1> <p><b>Question 1</b> <?php if ($_SESSION['q1'] == "1"){ echo("<b>Correct</b>"); $protectscore = $protectscore +1; }else{ echo("<b>Incorrect</b>"); } ?><BR> <b>Question 2</b> <?php if ($_SESSION['q2'] == "2") { echo("<b>Correct</b>"); $protectscore = $protectscore +1; }else{ echo("<b>Incorrect</b>"); } ?><BR> <b>Question 3</b> <?php if ($_SESSION['q3'] == "3") { echo("<b>Correct</b>"); $protectscore = $protectscore +1; }else{ echo("<b>Incorrect</b>"); } ?><BR> <b>Question 4</b> <?php if ($_SESSION['q4'] == "1") { echo("<b>Correct</b>"); $protectscore = $protectscore +1; }else{ echo("<b>Incorrect</b>"); } ?><BR> <b>Question 5</b> <?php if ($_SESSION['q5'] == "2") { echo("<b>Correct</b>"); $protectscore = $protectscore +1; }else{ echo("<b>Incorrect</b>"); } ?> <h1>Detection Section</h1> <b>Question 1</b> <?php if ($_SESSION['q6'] == "3") { echo("<b>Correct</b>"); $detectscore = $detectscore +1; }else{ echo("<b>Incorrect</b>"); } ?><BR> <b>Question 2</b> <?php if ($_SESSION['q7'] == "3") { echo("<b>Correct</b>"); $detectscore = $detectscore +1; }else{ echo("<b>Incorrect</b>"); } ?><BR> <b>Question 3</b> <?php if ($_SESSION['q8'] == "1") { echo("<b>Correct</b>"); $detectscore = $detectscore +1; }else{ echo("<b>Incorrect</b>"); } ?><BR><b>Question 4</b> <?php if ($_SESSION['q9'] == "2") { echo("<b>Correct</b>"); $detectscore = $detectscore +1; }else{ echo("<b>Incorrect</b>"); } ?><BR><b>Question 5</b> <?php if ($_SESSION['q10'] == "1") { echo("<b>Correct</b>"); $detectscore = $detectscore +1; }else{ echo("<b>Incorrect</b>"); } ?> <h1>Resolve Section</h1> <b>Question 1</b> <?php if ($_SESSION['q11'] == "2") { echo("<b>Correct</b>"); $resolvescore = $resolvescore +1; }else{ echo("<b>Incorrect</b>"); } ?><BR> <b>Question 2</b> <?php if ($_SESSION['q12'] == "1") { echo("<b>Correct</b>"); $resolvescore = $resolvescore +1; }else{ echo("<b>Incorrect</b>"); } ?><b><BR>Question 3</b> <?php if ($_SESSION['q13'] == "3") { echo("<b>Correct</b>"); $resolvescore = $resolvescore +1; }else{ echo("<b>Incorrect</b>"); } ?><BR><b>Question 4</b> <?php if ($_SESSION['q14'] == "3") { echo("<b>Correct</b>"); $resolvescore = $resolvescore +1; }else{ echo("<b>Incorrect</b>"); } ?><BR> <b>Question 5</b> <?php if ($_SESSION['q15'] == "1") { echo("<b>Correct</b>"); $resolvescore = $resolvescore +1; }else{ echo("<b>Incorrect</b>"); } ?> </p> <hr> <b>Total Sco </b>You answered <?php echo ($protectscore + $detectscore + $resolvescore); ?> question<?php if ($overallScore != 1) { echo("s"); } ?> Correctly <?php $qs = '15'; $overallScore = $protectscore + $detectscore + $resolvescore; $overallPercent = number_format(($overallScore * 100) / $qs); $ProtectionPercent = number_format(($protectscore * 100) / 5); $DetectionPercent = number_format(($detectscore * 100) / 5); $ResolvingPercent = number_format(($resolvescore * 100) / 5); ?><BR> <strong>Total Percentage is:</strong> <?php echo $overallPercent?> % <BR> Your Percentage From Protection Section is: <?php echo $ProtectionPercent?> % <BR> Your Percentage From Detection Section is: <?php echo $DetectionPercent?> %<BR> Your Percentage From Resolving Section is: <?php echo $ResolvingPercent?> %<BR> <HR> This section adds the link perfectly fine <?php if ($ProtectionPercent <= 30){ // beg echo '<li><a href="http://www.google.com> View Personalised Protection Content</a>'; } elseif ($ProtectionPercent > 30 && $ProtectionPercent <= 60){ //int echo '<li><a href="http://www.youtube.com"> View Personalised Protection Content</a>'; } else //exp { echo '<li><a href="http://www.facebook.com">View Personalised Protection Content</a>'; } ?><BR> <HR> This link add fine, however when i add the resolving if statement. This link disappear here and the Resolving section just doesnt appear <?php if ($DetectionPercent <= 30){ // beg echo '<li><a href="http://www.google.com> View Personalised Detection Content</a>'; } elseif ($DetectionPercent > 30 && $DetectionPercent <= 60){ //int echo '<li><a href="http://www.youtube.com"> View Personalised Detection Content</a>'; } else //exp { echo '<li><a href="http://www.facebook.com">View Personalised Detection Content</a>'; } When this part is added, this is when the error occurs <?php if ($ResolvingPercent <= 30){ // beg echo '<li><a href="http://www.google.com> View Personalised Resolving Content</a>'; } elseif ($ResolvingPercent > 30 && $ResolvingPercent <= 60){ //int echo '<li><a href="http://www.youtube.com"> View Personalised Resolving Content</a>'; } else //exp { echo '<li><a href="http://www.facebook.com">View Personalised Resolving Content</a>'; } ?> ?> MOD EDIT: [code] . . . [/code] tags added. i have a database field called photo. it is used to generate photo id in a software progam for our soccer league. I also want to be able to view the photo on our approval page. could someone help me with the coding of the http h-link? i am having issues with it. the photo field has the following paramaters: images/picture.jpg i want the link on the approval page to look like this: <a href="http://bccsl.org/managers/images/picture.jpg">"http://bccsl.org/managers/images/picture.jpg</a> thanks stefan Code: [Select] <?php /* connection and protection */ include 'dbc.php'; page_protect(); mysql_query( "SET NAMES utf8" ); if(isset($_POST["update"]) AND isset($_POST["hiddenid"])) { $updated=false; $activateapproved=array(); $deactivateapproved=array(); foreach($_POST["hiddenid"] AS $value) { if(isset($_POST["checkboxapproved"][$value])) $activateapproved[]=intval($value); else $deactivateapproved[]=intval($value); } if(count($activateapproved)>0) { $SQL=sprintf("UPDATE players SET approved=1 WHERE id in (%s)" , implode(",", $activateapproved)); mysql_query($SQL) OR DIE(mysql_error()); $updated=true; } if(count($deactivateapproved)>0) { $SQL=sprintf("UPDATE players SET approved=0 WHERE id in (%s)" , implode(",", $deactivateapproved)); mysql_query($SQL) OR DIE(mysql_error()); $updated=true; } if($updated==true) { header("Location: ".$_SERVER["PHP_SELF"].""); exit(); } } ?> <!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>Player Approval</title> <script type="text/javascript" src="public_smo_scripts.js"></script> <link href="styles.css" rel="stylesheet" type="text/css"> </head> <body> <table width="100%" border="0" cellspacing="0" cellpadding="5" class="main"> <tr> <td colspan="3"> </td> </tr> <tr> <td width="160" valign="top"> <? include 'menu.php'; ?> <p> </p> <p> </p> <p> </p> <p> </p></td> <td width="732" valign="top"><p> </p> <?php if(isset($_GET["todo"]) AND $_GET["todo"]=="updated") { echo "Updated succesfully"; } ?> <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" name="Form"> <table border="1" cellpadding="2" cellspacing="2"> <tr> <td><div align="center">First</div></td> <td><div align="center">Last</div></td> <td><div align="center">Address</div></td> <td><div align="center">City</div></td> <td><div align="center">Postal</div></td> <td><div align="center">Phone #</div></td> <td><div align="center">Feet</div></td> <td><div align="center">Inches</div></td> <td><div align="center">Weight</div></td> <td><div align="center">Birthdate</div></td> <td><div align="center">Team ID</div></td> <td><div align="center">Type</div></td> <td><div align="center">photo</div></td> <td><div align="center">Date Added</div></td> <td><div align="center">Approved</div></td> </tr> <?php $sql="select * from players where teamid='$_POST[teamid]' order by status ASC"; $res=mysql_query($sql) or die(mysql_error()); while($r=mysql_fetch_assoc($res)) { ?> <tr> <input type="hidden" name="hiddenid[]" value="<?php echo $r["id"]?>"> <td> <div align="center"><?php echo empty($r["first"])?' ':htmlspecialchars($r["first"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["last"])?' ':htmlspecialchars($r["last"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["address"])?' ':htmlspecialchars($r["address"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["city"])?' ':htmlspecialchars($r["city"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["postal"])?' ':htmlspecialchars($r["postal"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["phone"])?' ':htmlspecialchars($r["phone"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["feet"])?' ':htmlspecialchars($r["feet"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["inches"])?' ':htmlspecialchars($r["inches"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["weight"])?' ':htmlspecialchars($r["weight"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["birth"])?' ':htmlspecialchars($r["birth"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["teamid"])?' ':htmlspecialchars($r["teamid"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["status"])?' ':htmlspecialchars($r["status"]); ?> </div></td> <td> <div align="center"><?php echo empty($r["photo"])?'<a href="http://bccsl.org/managers/:htmlspecialchars($r["photo"])</a>'; ?> </div></td> <td> <div align="center"><?php echo empty($r["dateadded"])?' ':htmlspecialchars($r["dateadded"]); ?> </div></td> <td> <div align="center"> <input type="checkbox" name="checkboxapproved[<?php echo $r["id"]?>]" value="1"<?php echo empty($r["approved"])?'':' checked="checked"'; ?> /> </div></td> </tr> <?php } ?> </table> <p> <input type="checkbox" name="checkall" onclick="checkUncheckAll(this);"/> select/unselect <input type="submit" value="update" name="update"> </p> </form> <table width="178" border="1" cellpadding="0" cellspacing="1"> <tr> <th colspan="2" scope="col">Type</th> </tr> <tr> <td width="113"><div align="center">Church Player</div></td> <td width="50"><div align="center">1</div></td> </tr> <tr> <td><div align="center">Import Player</div></td> <td><div align="center">2</div></td> </tr> <tr> <td><div align="center">Witness Player</div></td> <td><div align="center">3</div></td> </tr> </table> </td> <td width="196" valign="top"> </td> </tr> <tr> <td colspan="3"> </td> </tr> </table> </body> </html> <a href="http://bccsl.org/managers/">http://bccsl.org/managers/</a> Is it possible to add more then one thing in a link? so i can $_GET more then one thing from a link signup.php?state=1?name=sam i tried that and a few other things and it didnt work. Hey Guys, I'm querying a database that is going to return a html page. In this page I'm going to define content areas with a class. eg: <div class="category"></div> Anywhere I have this class in the html code, I want to dynamically insert a link into it. So when I retrieve the code from the database, I need the code to check for this tag (class="category") and add a standard link (<a href="..">Add new Category</a>) Not 100% sure whats the most efficient way to go about this. I'm trying to add a link to edit my results. Not sure the best way to create the link, nothing I've tried works. There's probably a better way than what I've tried: echo 'There were ', mysql_num_rows($result), ' Matching Photographers:'; while ($row = mysql_fetch_array($result)) { echo "<br />Photographer Info:<br />"; echo "Photographer Name: $row[name]<br />"; echo "Photographer Email: $row[email]<br />"; echo "Photographer ID: $row[PHOTOGRAPHERID]<br />"; echo "Photographer Company: $row[c_name]<br />"; echo "Edit Photographer <a href="update.php?id=' . $row[PHOTOGRAPHERID] . '">Here</a>"; } I have an 'I agree' button on this page https://www.setstuffrentals.com/credit-card-authorization/
I basically need the button to redirect to another web page after a customer hits 'I agree'. I don't know PHP much. Can someone help step by step, please? I have been becoming more and more familiar with PHP over the past few months, but this problem stumps me. How can I take a string of words separated by spaces taken from an XML feed (example: word1 word2 word3 word4) and turn it into something like this: <a href="word1">word1</a> <a href="word2">word2</a> ... and so on. This has to be done on the fly, since it is taking the words from the XML feed, they change depending on the page. I want them to be in a vertical column, and be able to link each one to the search page for that word, so each link has to be different. An even more in-depth problem, how can I sort it then so that there are multiple columns if necessary, say one page only has 3 words, but another has 50. How can I split them up into multiple vertical columns, say with 10 words in each? Have I confused anyone yet? I am sending emails using PHPMailer. My configuration is below.
When adding a link to the message, should I use anchor tags? Both seem to work. What is the implication to recipients who are not using HTML email?
On a side note, if anything below seems wrong, please let me know.
Thanks
$msg='<p>Hello</p><p>Link: http://phpmailer.worxware.com/</p><p>Link: http://phpmailer.worxware.com</p><a href="http://phpmailer.worxware.com">http://phpmailer.worxware.com</a>'; $mail = new myPHPMailer(true); $mail->AddReplyTo('myEmail@xxx.com', 'Michael Reed'); $mail->SetFrom('myEmail@xxx.com', 'Michael Reed'); $mail->AddAddress('johndoe@xxx.com', 'John Doe'); $mail->Subject = "Here is your email"; //AltBody property need not be sent since PHPMailer will create an alternate automatically $mail->MsgHTML($message); return ($mail->Send()); class myPHPMailer extends PHPMailer { public function __construct($allow_exceptions=false){ $this->isSMTP(); $this->SMTPDebug = 0; $this->Host = "smtp.gmail.com"; $this->Port = 587; $this->SMTPSecure='tls'; // sets the prefix to the server. Used for gmail only. $this->SMTPAuth = true; $this->Username = 'xxx'; $this->Password = 'xxx'; } } Hi, I am adding "active_filter", "passive_filter" classes to links based on regex pattern coming from the URL: Line 46: https://github.com/laanes/product_filtering/blob/master/APF_URL.php The function gets called on line 89 in he https://github.com/laanes/product_filtering/blob/master/boxes/advanced_product_filtering_box.inc.php You can see it in action he http://www.swanseatimber.co.uk/shop/hafele/brand_281.html by clicking on a category on the left, under the heading "Filter Your Results". The clicked category gets a green background because of the added "active_filter" class. When you click again, it will get "passive_filter" class and the products are not filtered any more. The problem: When moving to other pages by using the pagination at the top of the product results, the class doesn't get added. Therefore, you can't remove the filter because function creating the href on line 72 in he https://github.com/laanes/product_filtering/blob/master/APF_URL.php and the function clearing all filters on line 100 in he https://github.com/laanes/product_filtering/blob/master/APF_URL.php both fail. What's interesting - when selecting a filter, moving to the next page, clicking in the browser url bar and hiting enter(hard reload i think?), the problem disappears and you can play with the filters again. I really hope you find a minute to look into it and help me. Hi im having some trouble when i try to add values to an array from a function. The added value will not stay saved. fun1 will display both firstname and surname but when i call fun2 after calling fun1 i just get the firstname. I would like to have it so the array is updated and stays updated untill it is cleared or over written. Any help with this would be greatly appreciated. i am using codeigniter if that makes any difference. Thanks <?php class Test extends Controller { var $data1 = array( 'firstname' => 'craig' ); function fun1() { global $data1; $this->data1['surname'] = 'brute'; echo "<pre>"; print_r($this->data1); } function fun2() { global $data1; echo "<pre>"; print_r($this->data1); } } This would seem like a simple question, but I can't seem to find the answer anywhere. Perhaps I'm asking it wrong. What I'd like to do is add a hash of optional arguments for a function. For example, I might have a function that has two required arguments, and three optional arguments. The only way I know to design this function is to put the arguments in a specific order, and fill them out to the degree needed. So if the 5th argument needs to be called, but the 3rd and 4th don't, you'd still have to give them values. function example($arg1, $arg2, $arg3, $arg4, $arg5) Must be used by: example('red', 'horse', '', '', 'texas'); Is there anyway of designing a function to only use the specified arguments? example('red', 'horse', ['arg5: texas']); I cant figure out how to add $recieved into this needs to take place of time hope someone knows how to do this what im doing is adding in the UNIX time i want to offset Code: [Select] <?php $offset = date('m/d/Y/H:i:s', time()+$send1['time_offset']); ?> Hi all. I try to adding checkbox when I call my function, my Class code is Code: [Select] class SQLconn{ function fetchData($table_name, $argument, $linebreak, $end_linebreak){ $result = mysql_query("select * from $table_name where status='$argument'"); while($row=mysql_fetch_row($result)){ echo $linebreak.$row[1]."<input type='checkbox' name='option' id='checkbox' value=$row[0] />".$end_linebreak; //$row[0] is 'job_id' from database } } } and my view code is like this Code: [Select] <?php $connect = new SQLconn(config()); $connect->connectDB(); $connect->fetchData("todo", "Undone", "<li>", "</li>"); //this is where the problem is $connect->closeConn(); ?> With that code I succesfully achieve my goal to add checkbox with right 'job_id' value but this is a workaround and not good because if I code it this way my function will be broken if use it somewhere else. My question is, how can I fix my code so I can add checkbox to view page but I can keep my function clean? Really need opinion about this?? I made a function which displays the left and right children of the root. However i need to add serial numbers to them. Due to Recursive functions i'm not quite able to to do so . Can someone please help me? Code: [Select] function side_display($root) { $sql = "SELECT lchild,rchild FROM tree WHERE parent='".$root."'"; $sqlexec = mysql_query($sql); $array = mysql_fetch_array($sqlexec); if(!empty($array['lchild']) && $array['lchild'] != '0') { echo "<tr>"; echo "<td>".($array['lchild'])."</td>"; $get = "SELECT * FROM member WHERE member_id='".$array['lchild']."'"; $execget = mysql_query($get); $getarray = mysql_fetch_array($execget); echo "<td>".$getarray['fname']." ".$getarray['lname']."</td>"; echo "<td>".$getarray['id_sponsor']."</td>" ; echo "<td>Left</td>"; echo "<td>".$getarray['doj']."</td>" ; echo "</tr>"; side_display($array['lchild']); } if(!empty($array['rchild']) && $array['rchild'] != '0') { echo "<tr>"; echo "<td>".($array['rchild'])."</td>"; $get = "SELECT * FROM member WHERE member_id='".$array['rchild']."'"; $execget = mysql_query($get); $getarray = mysql_fetch_array($execget); echo "<td>".$getarray['fname']." ".$getarray['lname']."</td>"; echo "<td>".$getarray['id_sponsor']."</td>" ; echo "<td>Right</td>"; echo "<td>".$getarray['doj']."</td>" ; echo "</tr>"; side_display($array['rchild']); } } The web application should allow the user to view the items in a catalogue, add items to a shopping cart, remove items from the shopping cart, and to view the contents of the shopping cart. Hey guys. Right ill try explain as best i can. Basicly we were told to write a php script that can view a shopping cart. The items in the catalogue should be stored as an array of objects. (The next assignment will require you to store this list of objects in a database). There should also be pages to allow the user to add, edit and delete items in the catalogue. Thats taken from a brief.Ive spent the most of the week getting it to view a catalog and now it can add items.view the cart its added them to and remove them from the cart and return. What im having trouble with is making the add function for the the other users or admin* to add/edit/delete.i reckoned adding and deleting wouldnt be so bad considering ive alrready done so.But im kinda stumped on how to do it.i think what the brief wanted was a seprate product add that would actully let u add another product to the cart list on the same page and then u can add that to the shopping basket etc. Yea real stumped.if only it was through sql it would be so much handier. ill post the code below.if anyone can help at all in the slightest id be so grateful.Thank you. view_leader.php
I have a feeling someone is going to say AJAX but here goes, Currently I have a basic php / html page the goes something like this: 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=utf-8" /> <title>BASIC HTML PAGE</title> </head> <body> <?php include 'home.inc.php'; ?> </body> </html> Now I've added some links: Code: [Select] <li><a href="#">Add</a></li> What I'm after is when someone click on that link is it changes the <?php include 'home.inc.php'; ?> From the base file to <?php include 'add.inc.php'; ?> Help much appreciated! In a script links are captured from the internet by $link, then display it by echo $link The links have the general format of http://domain.com/something/filename.html I am looking for a simple way to display capture some elements from $link and display "domain.com" and "filename" In other words, I need a code to remove other parts of the link provided by $link Hi there guys I have a problem that I can't seem to get fixed.
Below Is the code I am using and the Link to the Tutorial:
http://fearlessflyer...x-and-timthumb/
I have a page which reads content from a database and display its result.
<?php include ("databaseconnections/conx_stampsforsale.php"); $sql = mysql_query("SELECT country, description, price FROM stampsforsale"); if (!$sql) die ("Error Displaying Data. " . mysql_error()); else { echo ("<table><tr>"); $count = 0; while ($row = mysql_fetch_array($sql)) { $target_path = "stampsforsale/" . basename($row['country'] . ".jpg"); echo ("<td><a href='" . $target_path . "' target='_blank'><img src='" . $target_path . "'width=150 height=100></a><br />" . $row['country'] . "<br />" . $row['description'] . "</br>" . $row['price'] . "<br /><br /></td>"); $count++; if ($count % 3 == 0) { echo ("<tr>"); } } echo ("</tr></table>"); } // end of displaying data ?>The above code works fine and it loads inside a the main section on my web page as follows: index.php?mC=stampsforexchange.php. In order not to get a huge number of results I am planning to put the above code inside a function and then set the stampforexchange.php page with flags for each country so that when a particular country is clicked only stamps from that country are shown. The following is the above code revised into a function. <?php include ("databaseconnections/conx_stampsforsale.php"); function getCountryStamps($country) { $sql = mysql_query("SELECT country, description, price FROM stampsforsale WHERE country = $country"); if (!$sql) die ("Error Displaying Data. " . mysql_error()); else { echo ("<table><tr>"); $count = 0; while ($row = mysql_fetch_array($sql)) { $target_path = "stampsforsale/" . basename($row['country'] . ".jpg"); echo ("<td><a href='" . $target_path . "' target='_blank'><img src='" . $target_path . "'width=150 height=100></a><br />" . $row['country'] . "<br />" . $row['description'] . "</br>" . $row['price'] . "<br /><br /></td>"); $count++; if ($count % 3 == 0) { echo ("<tr>"); } } echo ("</tr></table>"); } // end of displaying data } ?>And this is the html part where I am trying to call the function: <td><a href="index.php?mC=getCountryStamps(Malta)"><img src="flags/malta.gif" width=100px height="67px" /><br />Malta</td></a> However I am getting the following warning message: Warning: include(getCountryStamps(Malta)): failed to open stream: No such file or directory in C:\xampp\htdocs\stamps\index.php on line 21 Warning: include(): Failed opening 'getCountryStamps(Malta)' for inclusion (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\stamps\index.php on line 21 Can someone please point in the right direction as I am stuck with this one? Thank you in advance. |