PHP - Moved: Anchor Name Tag Issues . Please Help
This topic has been moved to HTML Help.
http://www.phpfreaks.com/forums/index.php?topic=347032.0 Similar TutorialsThis topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=356942.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=353723.0 This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=327118.0 This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=322255.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=306846.0 Hello everyone. I'm trying to learn php here on the fly because i've been tasked with moving an existing internal website to a new server because the old one is failing fast. The failing server is very old and running a much older version of php. This form when submitted should send an email but the submit button doesn't even show when running the form on the new server. Also, right now all the text fields are showing the VALUE= value. I notice if I remove VALUE= from each part that removes the text but I'm not sure if that's the proper way to fix it.
Also, after the "Please wait for confirmation..." message, there is one text box prepopulated with \"ds\", then one below it with \"Click, then it appears to dump the rest of the code after </FORM> up to the last ?> onto the webpage as text.
I'm guessing some coding methods changed between php4 and whatever the newest version of php is that comes with a fresh linux server install. Can anyone offer any tips or fixes? Thanks in advance.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Update My Phone Number</title> </head> <body bgcolor="White" > <table width="640"> <tr><td><hr width="640" size="2" color="Red" align="left"></td></tr> <tr><td align="left"><font size="+3"><strong>Update Employee Telephone Numbers</strong></font></td></tr> <tr><td><hr width="640" size="2" color="gray" align="left"></td></tr> </table> <br> <? $form_block = " <FORM METHOD=\"post\" ACTION=\"$PHP_SELF\"> <p><strong>Employee name: <font size=\"-1\"><em>(Exactly as it should be listed)</em></font> <font color=\"#FF0000\">**Required</font></strong><br> <INPUT TYPE=\"text\" NAME=\"employee\" VALUE=\"$employee\" SIZE=\"75\" MAXLENGTH=\"100\"></p> <p><strong>Department: <font size=\"-1\"><em>(Exactly as it should be listed)</em></font> <font color=\"#FF0000\">**Required</font></strong><br> <INPUT TYPE=\"text\" NAME=\"department\" VALUE=\"$department\" SIZE=\"75\" MAXLENGTH=\"50\"></p> <p><strong>Work Phone Number <font color=\"#FF0000\">**Required</font></strong><br> <INPUT TYPE=\"text\" NAME=\"work\" VALUE=\"$work\" SIZE=\"15\" MAXLENGTH=\"15\"></p> <p><strong>Cell Phone Number <font color=\"#FF0000\">**Required -- enter \"na\" for not applicable</font></strong><br> <INPUT TYPE=\"text\" NAME=\"cell\" VALUE=\"$cell\" SIZE=\"15\" MAXLENGTH=\"15\"></p> <p><strong>Home Phone Number <font color=\"#FF0000\">**Required -- enter \"na\" for not applicable</font></strong><br> <INPUT type=\"text\" Name=\"home\" VALUE=\"$home\" SIZE=15 \" MAXLENGTH=\"15\"> </p> <p><strong>Pager Number <font color=\"#FF0000\">**Leave blank if you don't have a pager</font></strong><br> <INPUT type=\"text\" Name=\"pager\" VALUE=\"$pager\" SIZE=15 MAXLENGTH=\"15\"> </p> <p><strong>Comments:</strong><br> <TEXTAREA NAME=\"message\" ROWS=5 COLS=50 WRAP=virtual>$message</TEXTAREA></p> <br> <p><em>Please wait for confirmation - this may take a few seconds.</em></p> <INPUT type=\"hidden\" name=\"op\" value=\"ds\"> <p><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Click here to send this report\"></p> <br> </FORM> "; if ($op != "ds") { //they need to see the form echo "$form_block"; } else if ($op == "ds") { if ($employee == "") { $employee_err = "<font color=red>Please enter employee name! **REQUIRED</font><br>"; $send = "no"; } if ($department == "") { $department_err = "<font color=red>Please enter your department! **REQUIRED</font><br>"; $send = "no"; } if ($work == "") { $work_err = "<font color=red>Please enter your work phone! **REQUIRED</font><br>"; $send = "no"; } if ($cell == "") { $cell_err = "<font color=red>Please enter your cell phone! ** REQUIRED, enter \"na\" for not applicable</font><br>"; $send = "no"; } if ($home == "") { $home_err = "<font color=red>Please enter your home phone! *REQUIRED, enter \"na\" for not applicable!</font><br>"; $send = "no"; } if ($send != "no") { // it's okay to send $msg = "Please update the following phone numbers for: \t$employee\n\n"; $msg .= "Employee name:\t$employee\n\n"; $msg .= "Department:\t$department\n\n"; $msg .= "Work:\t$work\n\n"; $msg .= "Cell:\t$cell\n\n"; $msg .= "Home:\t$home\n\n"; $msg .= "Pager:\t$pager\n\n"; $msg .= "Comments:\t$message\n\n"; $to = "me@me.com"; $subject = "Phone Update: \t$employee, - \t$department\n"; $mailheaders = "From: UpdateMyPhone\n\n"; mail($to, $subject, $msg, $mailheaders); echo "<h1><font color=blue>Thank you! Your phone update has been filed. </font></h1><br> $form_block "; } else if ($send == "no") { echo "$employee_err"; echo "$department_err"; echo "$work_err"; echo "$cell_err"; echo "$home_err"; echo "$pager_err"; echo "$message_err"; echo "$form_block"; } } ?> </body> </html> Hey guys, I want to add an achor tag in my php script leading to another php file. Instead of writing the php below it. Code: $content=''; In between of the two "'" i would like to have the file name with its extension: clickpost.php Thanks in advance Is it possible to use #anchors to set a variable in PHP? For instance if I the url was http://example.com/portfolio.php#flash have $location = flash ??? Here is my code so far.. <script type="text/javascript"> Shadowbox.open({ content: '<div id="<?php echo "$location" ?> ">Welcome to my website!</div>', player: "html", title: "Welcome", height: 350, width: 350 }); </script> Thanks in advance Dear All, I wanted to know why the following syntax does not work when targeting an anchor Code: [Select] index.php?page=TechnologyTransferTest&section=BTI-TN5B1#ntro Bu this one does Code: [Select] BTI-TN5B1.php#ntro Can anyone help? Folks, I tired all my PHP skills to extract domain name strings from a RSS Feed and put each domain name as an Array element, but all in vain: Here is the RSS: http://bulliesatwork.co.uk/master/dev/domp/expdom/domains.php() What i want to extract: Quote Do you see a list of domain names, which are Anchored, all i need is to extract these domain names llik "abc.co uk" (observe there is a space between .co and uk, which can be removed with str_replace()) Here is my first try: (Using SimpleHTMLDomParser) Code: [Select] require_once('simple_html_dom.php'); $html = file_get_html('http://bulliesatwork.co.uk/master/dev/domp/expdom/domains.php'); $domains = $html->find('div[class="entry"] a', 0); foreach($domains as $dom) { echo str_replace(' ', '.', $dom->plaintext); } $html->clear(); unset($html); Here is my another try with DOM Document: Code: [Select] $scrapeurl = 'http://bulliesatwork.co.uk/master/dev/domp/expdom/domains.php'; $keywords = file_get_contents($scrapeurl); $keywords = json_decode($keywords); foreach( $keywords->responseData->results as $keyword) { echo str_replace("...",".",$keyword->title).'<br/>'; } In both the cases, DOM document is created but it seems the Document has all information except the Domain names i want to extract. Please help me out to extract the doamin names. Cheers Hello, i am trying to pull the innerHTML out of this: Code: [Select] <a href="(.*?)">(.*?)</a> here is what I have: Code: [Select] <?php $html = file_get_contents("http://www.businessinvestingsource.com/blcheck2.html"); preg_match_all('/<a href="(.*?)">(.*?)<\/a>/', $html, $links, PREG_SET_ORDER); foreach ($links as $link) { $linkto = $link[1]; $anchor = $link[0]; echo "<b>Link:</b> ".$linkto."<br /><b>Anchor:</b> ".$anchor."<br /><br /> "; } ?> Now this code works but the innerHTML is coming out as a link I want it to come out as plaintext you can view he http://businessinvestingsource.com/anchorcheck2.php Can anyone help? Thank you. Hi guys. Im not sure if this is normal in php. But if someone could help. Its much appreciated! I try to do an anchor link on another page, here is my example: <a name="testi"></a> //somewhere above the code below <a href='$targetpage?page=$prev#testi'>prev</a> //anchor link When i click on "prev" link, it direct me to another page correctly. But my page name/title which is: <title>Testimonials | Ten International</title> //page name appears to be Testimonials | Ten International#testi How do i actually make the word #testi in my page name/title disappear of hidden? How can I get http_referer to retrieve the anchor in the url? It keeps url variables, but it does not get the anchor. Example: http://example.com/ex.php?id=10#tab=3 All http_referrer catches is http://example.com/ex.php?id=10 code: Code: [Select] $refer = $_SERVER['HTTP_REFERER']; <script type="text/javascript"> <!-- window.location = "<?PHP echo"$refer";?>" //--> </script> How can I achieve the following scenario with an anchor tag? Code: [Select] if(isset($_POST['submit'])) { // execute script } I do need it for a label system to sort content with labels. if the url is my-domain.com/some_page#here_is_an_anchor is there anyway to read that anchor value server side? parse_url() shows that it can parse the value, but the examples for that function are setting the value of the URL as a string, hard-coded into the script. I need to detect the URL dynamically. My suspicion is that this is impossible but I figured it can't hurt to ask. Thanks for any advice. what is the problem in this code <div id="product"> <a class='inline' href="?prod=<?php echo $row['id'];?>#<?php echo $row['id']; ?>" > ..... </a> </div> <div style='display:none'> <div id='<?php echo $row['id'];?>'> .... </div> </div> $prod=$_GET['prod']; echo "the value of prod".$prod; $_SESSION['cart']=$prod; <script> $(document).ready(function(){ //Examples of how to assign the ColorBox event to elements $(".inline").colorbox({inline:true}); }); </script> Hello, I am trying to get this backlink checker to work i have it working so it checks that the link itself matches and is there but this is the harder part that I don't understand. I want to have it also check the nodeValue to make sure that it matches one of the nodeValue's from a mysql table this is the code I have to make it check the href link Code: [Select] function CheckForTargetUrl($links, $target) { foreach ($links as $link) { if (strpos($link, $target) !== false) { return true; } } return false; } function ExtractHrefLinks($html) { $dom = new DOMDocument; $linkUrls = array(); @$dom->loadHTML($html); $links = $dom->getElementsByTagName('a'); foreach ($links as $link){ $linkUrls[] = $link->getAttribute('href'); } return $linkUrls; } function backlink_check($contenturl){ $url = 'businessinvestingsource.com'; $source = $contenturl; $falseFound = false; $html = file_get_contents ( $source ); $links = ExtractHrefLinks($html); if (CheckForTargetUrl($links, $url) === false) { $falseFound = "true"; $reportArray[$source] = 0; } else { $falseFound = "false"; } return $falseFound; } Now this all works fine, I just need it to check the actual nodeValue (anchor text as well) meaning check this: <a href="http://google.com">Google</a> There is a mysql table called "allowed_anchors" with 2 rows "id" and "anchor" I need it to check if the nodeValue matches 1 of the allowed_anchors from the table. If anyone knows how I can do this that would be very great i have been trying to figure it out for hours with no luck. Thanks very much for any help to come. Hi Still very new to PHP but getting some good use out of it with includes. I'm currently using this code to check the file name of the page and then give the corresponding anchor tag a class of active in order to style my main menu. This is all working for most of my pages but my problem is that I now have multiple files called index.php one in the root of my site and some are in folders. Is there any way around this issue? Can PHP check to see if its the index file in the root of the site or is there a better way. I suppose I could create a second variable in the index file in my root ie my home page and then check to say if the current page is called index and has the variable of home but how would I write this? My code Code: [Select] $currentPage = basename($_SERVER['SCRIPT_NAME'], '.php'); <li><a href="/" <?php if ($currentPage == 'index') {echo 'class="active"';} ?>>Home</a></li> The script for creating a new file name for the image:
$validextensions = array("jpeg", "jpg", "png"); //Extensions which are allowed $ext = explode('.', basename($_FILES['file']['name'][$i]));//explode file name from dot(.) $file_extension = end($ext); //store extensions in the variable $new_image_name = md5(uniqid()) . "." . $ext[count($ext) - 1]; $target_path = $target_path . $new_image_name;//set the target path with a new name of imageThe script creates a new file like: f6c9b8d9db05366c3504210cded9ddb2.jpgand moves the file to the "uploads" folder. And then the script also creates a thumbnail with the same file name and moves the file to the "thumbs" folder. The issue I am having is that the same ID code could happen again for a different image in the database, thus I would be calling a different original sized image than the thumbnail image. My question is: How to avoid this issue of the same ID code has happened again for a different file. What is the proper way to reference the anchor tag of the thumbnail image to its actual original sized image? With the script I have the thumbnail image would be coming from the "thumbs" folder and the anchor tag would get referenced to the "uploads" folder to get the original sized image. Edited by glassfish, 12 October 2014 - 05:51 AM. Hello, I'm having troubles parsing text properly. Whenever I submit data into a mysql db, and then call that specific data, in the text, I get this symbol, �. Does anybody know what it is or how to remove it? I believe it's with utf-8 and me using a function that corrupts the string but I'm not sure. Anybody have any clues? Thanks in advance. |