Jump to content

Get anchor tag with php


simun

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.