PHP - Funtion Won't Run From Link
Quote
Hi people, I've written a real simple class call User, wich has the most basic of functions in it The one called output returns some data from the database along with a delete link wich should call the delete function from the same class I have no idea why it won't run..... I'm stumped as to what i'm doing wrong PLEASE SHOW ME WHERE MY STUFF UP IS... Quote This is the class called user <?php class User extends Database { function read() { $this->query("SELECT * FROM sales_peepl;"); } function delete($id) { $this->query("DELETE * FROM sales_peepl WHERE salesid = {$id};"); } function output() { return $this->_row->sales_person ." - ". $this->_row->access . " " . '<a href="?=action=$this->delete&id='.$this->_row->salesid.'">delete</a>' . "<br/>"; } } ?> Quote and this is the output page wich shows the data and link <?php include_once($_SERVER['DOCUMENT_ROOT'] . '/sales/includes/global.php'); $t = new User(); $t->connect(HOST, USERNAME , PASSWORD, DATABASE); $t->read(); ?> <html><head><title></title> </head> <body> <?php while ( $t->next()) { echo $t->output() . " "; } ?> </body> </html> Quote As you can see its very basic...... But the bloody link won't work Similar Tutorialscan anybody tell me how i can complete this function in php? // $page = html source file define("LIST_OF_SCHOOLS", "Piarsaigh,Phiarsaigh,Vincents"); $schoolList = explode(',', LIST_OF_SCHOOLS); function checkForSchool($page, $schoolList) { preg_match('|Goes to \\\u003ca href=\\\\"http:\\\/\\\/www.facebook.com\\\/pages\\\/[a-zA-Z-]*\\\/\d*\\\\" data-hovercard=\\\\"\\\/ajax\\\/hovercard\\\/page.php\?[a-zA-Z=0-9]*\\\\">([a-zA-Z\s]*)\\\u003c\\\/a>|', $page, $match); if($match && count($match)>0) { echo "Match Found"; // if any of the words in the schoolList array is found in the match from the preg_match function let the // checkForSchool function return true // other wise return false } } } I apologize if I am in the wrong forum so I hope somebody can help. I have a function which sends an emails to client everytime an order is processed. They have asked me to add a print button in the emails so they could just print the email. I have tried using javascript and call the window.print function but when I click the button nothing happens. I know that it is possible to add a print button in an email but I can't figure out what I am doing wrong. Here is some of the code use to create the email using paypal ipn script. Code: [Select] $body = "<html>". "<head>". "<script type='text/javascript'>". "//<![CDATA[ function PrintEmail(){ window.print(); } //]]> ". "</script>". "</head>". "<body>". "<a href='javascript:window.print()'>Print Page</a><br />". "<input type='button' onclick='javascript:PrintEmail();' value='Print This Page' /><br /><b>Customer Name</b>: ".$name."<br />"; foreach($id_str_array as $key => $value){ $id_quantity_pair = explode(":", $value); $product_id = $id_quantity_pair[0]; // Get the product ID $cameo_color = $id_quantity_pair[1]; $product_quantity = $id_quantity_pair[2]; // Get the quantity $product_line1 = $id_quantity_pair[3]; // Get Line 1 $product_line2 = $id_quantity_pair[4]; // Get Line 2 $product_picture = $id_quantity_pair[5]; // Get picture $discount_code = $id_quantity_pair[6]; $body .= "<b>Product</b>: ".$product_id."<br />". "<b>Quantity</b>: ".$product_quantity."<br />". "<b>Engraving Line 1</b>: ".$product_line1."<br />". "<b>Engraving Line 2</b>: ".$product_line2."<br />". "<b>Your picture</b>: <img src='http://t3.sysguru.com/mcf/pictures/".$product_picture."' height='300' width='556' /><br />"; } $body .= "<b>Total</b>: $".$_POST['mc_gross']."</body></html>"; $subject = "Transaction Completed"; $mailer->SendPayPalInfo($subject, $body); I tried just calling the javascript print function with a link and aslo create a function and called the function from the button and neither of these methods work. here is the code which send the message out. Code: [Select] function SendPayPalInfo($subject, $body){ $headers = "From: " .EMAIL_FROM_ADDR. "\r\n"; $headers .= "Reply-To: ".EMAIL_FROM_ADDR."\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; return mail(EMAIL_FROM_ADDR, $subject, $body, $headers); } Am I missing something in the headers of am I coding this wrong? Any help would be appreciated. Hey guys, I'm looking for some sort of tutorial on how to code a search script which would allow users to select number of results per page (and take care of the page 1, page 2, etc. links accordingly) as well as order them by date, most views, etc. I thought I'd be good to do this on my own but my script is looking very dirty and I'm pretty sure it isn't very secure.. anyone ever consult a tutorial with main guidance as how to code the kind of script I'm interested in?? thanks Hello.
I have a bit of a problem. When I fetch the link field from the database.i don't see an actual link on the page.
One more thing, what type of field should I use to store the link in the database? Probably there is where I went wrong.
All help is
Hi I've got this database I created with fields ProductId ProductName Image I've managed to get it to list the ID,productname, and Image urls in a list. My next step is to have the image field actually display an image and make it clickable: heres what I've done so far: Code: [Select] <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("productfeed", $con); $result = mysql_query("SELECT * FROM productfeeds"); echo "<table border='0'> <tr> <th>Firstname</th> <th>Lastname</th> <th>Image</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['ProductID'] . "</td>"; echo "<td>" . $row['ProductName'] . "</td>"; echo "<td>" . $row['ImageURL'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Heres what I want to do: Code: [Select] while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['ProductID'] . "</td>"; echo "<td>" . $row['ProductName'] . "</td>"; // my changes beneath echo "<td>" . <a href="<?php echo $row['ImageURL'];?>"> <img src="<?php echo $row['LinkURL']; ?>"> </a>. "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Can you guys point me in the right direction? Many thanks Hi Support, I have a form, where it collects user description input. I can collect the inputs and store it with newline. The issue is - how to collect the http link to actual hyperlink ref during display. The following is my code: <textarea name="description" cols="50" rows="10" id="description"><?php echo str_replace("<br>", "\n", $description);?></textarea></td> For example, User input: Hi, Check it out - http://www.google.com/ I would like to display google link as href so that Viewers can click the link and go to the page. Right now, it is not href and user need to copy the link to new tabs or pages and then it can come. Thanks for your help. Regards, Ahsan hi hope you all are fine. i have been working on a Email Form (like user fills up the form which send the information to our email) but i was having problem with (URL field i created) link of form is (http://services.shadowaura.com/allquotations/static.php) field which is not working is "Inspirational Website:" when i submit the form it says (Forbidden You don't have permission to access /allquotations/staticworking.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.) Can some one help me out ????????????? code behind this form is: Code: [Select] <?php /* Email Variables */ $emailSubject = 'Shadow Aura Contact Info!'; $webMaster = '*****@shadowaura.com'; /* Data Variables */ $Name = $_POST['Name']; $email = $_POST['email']; $Cell = $_POST['Cell']; $Phone = $_POST['Phone']; $CompanyName = $_POST['CompanyName']; $TypeOfBusiness = $_POST['TypeOfBusiness']; $Address = $_POST['Address']; $YourBudget = $_POST['YourBudget']; $HaveDomain = $_POST['HaveDomain']; $RunningWeb = $_POST['RunningWeb']; $WebLink = $_POST['WebLink']; $Inspiration1 = $_POST['Inspiration1']; $Inspiration2 = $_POST['Inspiration2']; $NumberPages = $_POST['NumberPages']; $UseFlash = $_POST['UseFlash']; $TimeFrame = $_POST['TimeFrame']; $Provided = $_POST['Provided']; $Comments = $_POST['Comments']; $body = <<<EOD <h1> Static Website Quotation </h1> <br> <b>Name of Client:</b>$Name<br> <b>Your Email:</b>$email<br> <b>Cell Number:</b>$Cell<br> <b>Line Phone Number:</b>$Phone<br> <b>Company Name:</b>$CompanyName<br> <b>Type of Business:</b>$TypeOfBusiness<br> <b>Address:</b>$Address<br> <b>Your Budget:</b>$YourBudget <br> <b>Do you have Domain:</b>$HaveDomain<br> <b>Your Site is Running:</b>$RunningWeb <br> <b>Website Link:</b><a href="$WebLink">$WebLink</a><br> <b>Inspiration:</b>$Inspiration1<br> <b>2nd Inspiration:</b>$Inspiration2<br> <b>Number of Pages:</b>$NumberPages<br> <b>Use Flash:</b>$UseFlash <br> <b>Time Frame:</b>$TimeFrame<br> <b>You will provide:</b>$Provided<br> <b>Comments:</b>$Comments<br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <html> <head> <title>sent message</title> <meta http-equiv="refresh" content="3;URL=http://services.shadowaura.com/"> <style type="text/css"> <!-- body { background-color: #8CC640; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 20px; font-style: normal; line-height: normal; font-weight: normal; color: #fec001; text-decoration: none; padding-top: 200px; margin-left: 150px; width: 800px; } --> </style> </head> <div align="center">Your email will be answered soon as possible! You will return to <b>Shadow Aura Services</b> in a few seconds !</div> </div> </body> </html> EOD; echo "$theResults"; ?> here's my code that i've used to send an email. Code: [Select] $link = "<a href=\"http://www.example.com/" . $num . "\">" . $num . "</a>"; $query = "SELECT content FROM emails"; $result = mysql_query($query) or die(); $email_content = mysql_result($result, 0); $email = sprintf($email_content, $first, $name, $from, $link, $record, $rec, $inc, $max); $email_body = stripslashes(htmlentities($email, ENT_QUOTES, 'UTF-8')); // this is sent to another php script via post.... $subject = $_POST['subject']; $message = nl2br(html_entity_decode($_POST['email_body'])); $to = "me@whatever.com"; $charset='UTF-8'; $encoded_subject="=?$charset?B?" . base64_encode($subject) . "?=\n"; $headers="From: " . $userEmail . "\n" . "Content-Type: text/html; charset=$charset; format=flowed\n" . "MIME-Version: 1.0\n" . "Content-Transfer-Encoding: 8bit\n" . "X-Mailer: PHP\n"; mail($to,$encoded_subject,$message,$headers); in the db, emails.content is of the text type and contains several lines of text with %4$s which inserts the value of $link into the body. when the email arrives, there is a link and it appears fine, with the value of $num hyperlinked. however when you click on it it doesn't go anywhere. when copying the link location from the email it gives me x-msg://87/%22http://www.example.com/16 what is x-msg? how can i get this to work properly? Hi guys, I'm using a twitter script that grabs the title and publishings it like so: "Title - Read More at..." I was wondering how i would be able to post the direct link into twitter.. like news.php?id=1 for example. Code: [Select] $tweet->post('statuses/update', array('status' => ''.$_POST[title].' - more at MY URL')); This part is in the script to publish automatically when the users adds to the news database. How am i able to get the ID just after the posting of the news? Thanks! I have a line like this it prints text link but I prefer image link how should i edit it I would appreciate some feedback Code: [Select] $templates['etiket'] = array('name' => t('ETİKET'), 'module' => 'uc_invoice_pdf', 'path' => $templates_uc_invoice_pdf_path, 'pdf_settings' => $pdf_settings); This link dnt seem to work. Can someone help? echo "<td><a href =" . $rows['url'] .">"</a>"</td>"; Thankz. I have a lovely RSS creation script which dynamically writes an RSS feed using the information from the database, which you can automatically update every time a blog entry (or anything else generated by a script) is added. The only issue with it, is that the Code: [Select] <strong> tags have had to be deleted using strip_tags() because the RSS doesn't like it. I want to keep the original formatting of the blog article but because I have to strip out the strong links, the hyperlinks are also removed. I don't know enough about RSS (IMHO) to work out how to put the links back in - do I need to format the STRONG tags differently, or do i need to change the PHP to str_replace() the strong tags with nothing? Here's some code that does work: Code: [Select] <item rdf:about="http://www.manteya.com/blog/Music-Improves-Productivity_24.html"> <title>Music Improves Productivity</title> <link>http://www.manteya.com/blog/Music-Improves-Productivity_24.html</link> <description>Research shows that music can improve speed of working within organisations. There is a double-edged sword to this article, however. Music with fast tempos can help the release of adrenalin and therefore increase the heart rate of the listener. Music producers here in the UK have taken advantage And here's some that doesn't: Code: [Select] <item rdf:about="http://www.manteya.com/blog/Music-Improves-Productivity_24.html"> <title>Music Improves Productivity</title> <link>http://www.manteya.com/blog/Music-Improves-Productivity_24.html</link> <description>Research shows that music can improve <strong>speed</strong> of working within organisations. There is a double-edged sword to this article, however. Music with fast tempos can help the release of adrenalin and therefore increase the heart rate of the listener. Music producers here in the UK have taken advantage I'm sure you geniuses (or geniei) can work it out, so any help would be very welcome indeed. Hi Everyone, So I am building a page that list records from a table, in this case customers, and I want to the printed last name (lname) of the record to be the link to the a detail php page that displays the detailed record. Any suggestions on how to do that? Here is what I'm using now. I don't like the button look, that's why i'm trying to make a link. Any Suggestions? Thanks <? session_start(); include 'menu.php'; include ("include/connect.php"); // how many rows to show per page $rowsPerPage = 10; // by default we show first page $pageNum = 1; // if $_GET['page'] defined, use it as page number if(isset($_GET['page'])) { $pageNum = $_GET['page']; } // counting the offset $offset = ($pageNum - 1) * $rowsPerPage; $sql = @mysql_query("SELECT * FROM customer ORDER BY id LIMIT $offset, $rowsPerPage"); $id = ''; echo "<table border='0' align='center'><tr><td align='left' colspan='2'>Last Name</td><td align='center'>Location</td><td align='right'>Date Posted</td></tr>"; while ($row = mysql_fetch_array($sql)) { if ($id != $row['id']) { echo "<tr><td><form action='customerdetail.php' method='post'><input type='hidden' name='locationp' value='{$row['location']}' /><input type='hidden' name='titlep' value='{$row['title']}' /><input type='hidden' name='idp' value='{$row['id']}' /><b><font size='4'><input type='submit' value='{$row['lname']}'></font></b></form></td><td> </td><td align='center'><b><font size='4'>{$row['location']}</font></b></td><td align='right'><b><font size='4'> {$row['datep']}</font></b> </td></tr><tr><td colspan='4'> </td></tr>"; $id = $row['id']; } } echo "</table>"; // how many rows we have in database $query = "SELECT COUNT(id) AS numrows FROM customer"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; // how many pages we have when using paging? $maxPage = ceil($numrows/$rowsPerPage); // print the link to access each page $self = $_SERVER['PHP_SELF']; // creating previous and next link // plus the link to go straight to // the first and last page if ($pageNum > 1) { $page = $pageNum - 1; $prev = " <a href=\"$self?page=$page\">[Prev]</a> "; $first = "<br><center> <a href=\"$self?page=1\">[First Page]</a> "; } else { $prev = ' '; // we're on page one, don't print previous link $first = '<br><center> '; // nor the first page link } if ($pageNum < $maxPage) { $page = $pageNum + 1; $next = " <a href=\"$self?page=$page\">[Next]</a> "; $last = "<a href=\"$self?page=$maxPage\">[Last Page]</a></center> "; } else { $next = ' '; // we're on the last page, don't print next link $last = ' </center>'; // nor the last page link } // print the navigation link echo $first . $prev . " Showing page $pageNum of $maxPage pages " . $next . $last; // and close the database connection mysql_close($con) // ... and we're done! ?> Hello dear friends, Let say we have Code: [Select] $space ="hello world"; then remove spaces between the words by using Code: [Select] $title = str_replace(' ', '-', trim($space)); so it would be here as "hello-world" and let say we have stored title,article text...whever in an database table that call back all this using id then for an article with id=1 its link will be Code: [Select] site.com/index.php?id=1 it is clear that the Code: [Select] echo "$id"; //<--- 1 now some wordpress or/and blogs using rewrite .htaccess to make the link as Code: [Select] site.com/$title-$id (as our example site.com/hello-world-1) then how they know its $id = 1 to get any variables from database that needs the id i've tried but never works and only works if i made something like Code: [Select] site.com/$title_$id //<-- site.com/hello-word_1 cause it needs difference separate in order to understand the id so how to make it ? how to make it understand that the last separated is the id thanks Hello dear friends, Let say we have Code: [Select] $to = "gigi"; then we have link like this Code: [Select] mysite.com/$to_$id.html with indeed .htaccess code Code: [Select] RewriteRule -(.*)\.htm file.php?id=$1 it will works , Now what if i want to make the link like this Code: [Select] mysite.com/$id/$to.html what will be the .htaccess code in this way ??? Hi there! I'm not sure which section this questions belongs in however, it seems to fit well in PHP. Basically, I'm using this link to directly log me into the cPanel webmail: http://website.com:2095/login?user=email@website.com&pass=123 Which would log me into webmail with the details as: username: email@website.com password: 123 This works perfectly on FireFox, but on Internet Explorer, the popup login box still occurs. Why is this? Thanks I have a personal website that retrieves images from directories on the server. However, one of my directories has 1000+ images; which I don't want to be displayed on one page. Is there any way that I can have it so that the first 100 images are displayed on the page with a next link for the next 100 images. Kind of like the way that clothes are displayed on websites that have a large number of products. I am sorry if this is vague. Any help would be appreciated. Thanks I'd like to put a password requirement in this program & an expiration date (database record)so that at 11 months I output an alert and at the end of one year it shuts down. ? The below code works for the password but I can't find how to link to my main page? PHP Code: <?php mysql_connect(localhost,root,""); mysql_select_db(entrydb) or die( "Unable to select database"); if(!empty($_POST["submit"])) { $password = $_POST['password']; $expdate = $_POST['expdate']; $query="SELECT password, expdate FROM entrydata Where password='$password'"; $result=mysql_query($query); if(mysql_num_rows($result)) { echo "<form action='#' method='post'>"; echo "</form>"; } else{echo "Access denied<br />";} } ?> <form method="post" action="#"><br /> <input type="text" name="password"/><p> <input type="submit" name="submit" value="enter password"/> </form> Hello. I have been developing my website and I need to create a link that moves one information from one table to the other if a certain condition is found. I have already explained what my website is about in another post, but since the focus has now changed, I've proceeded into creating a new topic. The thing is, I have two databases: one for confirmed, one for not confirmed. I want to make a link, or a button, that upon its pressing would delete an user from one table and insert the same user to the other. My idea is exactly the same as the "Topic Solved" button from phpfreaks. Is it possible to be done in PHP? Thanks in advance. Hi guys; I have created a php form whereby users have the ability to upload a file to the server. After they click the submit button the form input is sent in an email with a path to the uploaded file. Whilst the email provides the direct path to the file it is not linkable. How do i do this. The code which sets the path is; Code: [Select] $body .= "\nPath: http://xxx/xxx/xxx/xxx/$target"; How can i change it so the path becomes a link in the email? |