simun Posted May 29, 2009 Share Posted May 29, 2009 i have a litle problem with getting anchor tags with php i have a link that goes to new page <td><a class="gallery" href="pages/dokument.php#<?=$object['id']?>">dokumenti</a></td> now the url on new page is http://rivieradekor.hr/katalog_admin/pages/dokument.php#15 on that page i need to echo a number 15 from my url but i cant make it work, i have tryed something with javascript that look like this <body onload="pasteUrl();"> <script type="text/javascript"> function pasteUrl() { url = window.location; var textBox2 = document.getElementById('g2'); textBox2.value = ( url .hash ); } </script> <input type="text" name="g2" id="g2" /> </body> this show #15 in textbox but i still cant echo it in php. Please help, tchanks Link to comment https://forums.phpfreaks.com/topic/160121-get-anchor-tag-with-php/ Share on other sites More sharing options...
Jibberish Posted May 29, 2009 Share Posted May 29, 2009 If your trying to pass a variable via a url, in php the url needs to look like this, http://rivieradekor.hr/katalog_admin/pages/dokument.php?a_number=15 then on the php page to put it into the box do, <input type="text" name="g2" id="g2" value="<?php echo $_GET['a_number']; ?>" /> Link to comment https://forums.phpfreaks.com/topic/160121-get-anchor-tag-with-php/#findComment-844791 Share on other sites More sharing options...
simun Posted May 29, 2009 Author Share Posted May 29, 2009 thanks, you realy help me Link to comment https://forums.phpfreaks.com/topic/160121-get-anchor-tag-with-php/#findComment-844794 Share on other sites More sharing options...
simun Posted May 29, 2009 Author Share Posted May 29, 2009 i have one more problem in this code <?php class ruverUpload{ var $uploadLocation; function ruverUpload(){ $this->uploadLocation = '../../static/gallery/products/'.DIRECTORY_SEPARATOR; } function setUploadLocation($dir){ $this->uploadLocation = $dir; } function showUploadForm($msg='',$error=''){ ?> <div id="container"> <div id="header"><div id="header_left"></div> <div id="header_main">Dokumenti</div><div id="header_right"></div></div> <div id="content"> <?php if ($msg != ''){ echo '<p class="msg">'.$msg.'</p>'; } else if ($error != ''){ echo '<p class="emsg">'.$error.'</p>'; } ?> <form action="" method="post" enctype="multipart/form-data" > <center> <label>File: <input name="myfile" type="file" size="30" /> </label> <label> <input type="submit" name="submitBtn" class="sbtn" value="Upload" /> </label> </center> </form> </div> </div> <?php } function uploadFile(){ if (!isset($_POST['submitBtn'])){ $this->showUploadForm(); } else { $msg = ''; $error = ''; //Check destination directory if (!file_exists($this->uploadLocation)){ $error = "The target directory doesn't exists!"; } else if (!is_writeable($this->uploadLocation)) { $error = "The target directory is not writeable!"; } else { $target_path = $this->uploadLocation . basename( $_FILES['myfile']['name']); if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) { $msg = basename( $_FILES['myfile']['name']). " was uploaded successfully!"; } else{ $error = "The upload process failed!"; } } $this->showUploadForm($msg,$error); } } } ?> i need to put here $this->uploadLocation = '../../static/gallery/products/'.DIRECTORY_SEPARATOR; after products/ echo $_GET['a_number']; but i cant get it work, please one more help thanks Link to comment https://forums.phpfreaks.com/topic/160121-get-anchor-tag-with-php/#findComment-844800 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.