I have a link below as it is found in a particular WordPress plugin:
<a href='".home_url("?p=7&action=get_marks&id=$select_data2->id")."' ></a>
I want to auto detect page_id when I click on it to reload the same page, like:
<a href='".home_url("?p=get_id&action=get_marks&id=$select_data2->id")."'></a>
I don't want to write page id every time I create new page after putting shortcode in.
I'm assuming you are talking about server side
echo ' '
where $id is a variable that has the id
Have you considered JavaScript on the client side?
thanks for your help
i tried several method until i found the solution
here the code
global $post;
echo '<a href='".home_url("?p=$post->ID&action=get_marks&id=$select_data2->id")."'>';
where $post->ID is a variable that has the page id
thanks #user74670 you give me inspiration to solve problem
Related
i generate link with
<a onclick="window.history.pushState('', '', '?id=<?php echo $row['id']; ?>');"
and it generated URL like this
http://localhost/dpmerzon/order.php?id=MT01
"MT01" is example id for every link i pressed
So can i get "MT01" value with (PHP) $_GET['id'] without submitting the URL ?
you have to use AJAX if you want to submit somthing in background
explaine more what you gona do may can i help you
I have a simple page. On this page, I have blocks. The blocks get their unique ids when clicked open (example: http://blog.com/#brands). The ids are variable:
<div class="block wide" id="<?php echo $postid ; ?>">
blog category
</div>
Someone clicks the link in the block & goes to the blog. Now the visitor is on the blog category page. But the visitor wants to go back to the homepage:
<span class="return-back">back</span>
But now, it is back to the top of the homepage. I want the visitor to be back at the variable id anchor of the blog:
<div class="block wide" id="<?php echo $postid ; ?>">
How do we make this happen? I am not a PHP developer (just CSS/JS/HTML). I've used Wordpress for this project. Thank you all so much!
The format for linking to a div through url is:
mypage.com/blog#blog_id
where blog_id is the id of the div you'd like to link to.
So, assuming $postid is the id of the div you want to link back to, try this:
back
This is actually impossible to solve without rebuilding everything. The next page doesn't know what $postid is.
Is there a way to put a php variable in an without it automatically being visible, like a GET variable?
Some click
I want the subsequent browser URL to be www.myphpfile.php (no variable visible).
Thanks for any help.
If I understood you right you want to have something like this:
Start a session and write the contents of $_GET['location'] into, e.g., $_SESSION['location'].
Redirect the user, e.g. header('Location: myfile.php');
If the user changes his location, start at 1
You could create a form for it with method="post" and style the submit button as a normal link using CSS.
That is if I understood you question correctly.
You should use <a href="fake" onclick="window.location=real">, but I prefer use links as The Lord W3C has declared originally.
Edit:
<a href="javascript:goto(nice_url_like_thing)">;
I have this code:
echo 'Send map to 2nd screen';
Id like to be able to press this link, which opens the case_util.php in another iframe and then goes to another link in its own iframe.
Sort of like a refresh/going back. However, it is a form, and pressing back retains the data in the form. I dont want this data in the form, hence I'd like it to navigate to the page.
Thanks :)
Syntax issues. document.location is not a function and is deprecated anyway.
Here is a better version
echo 'Send map to 2nd screen';
or easier to read since you want the href in the iframe named second .
...?> <a href="case_util.php?status=green&adr=<?php echo $adr; ?>" rel="nofollow" target="second"
onClick="window.location='create.php'" >Send map to 2nd screen</a>
Best answer:
Don't use iframes.
However if you are determined to use something as silly as an iframe, use something as silly as a meta redirect.
<meta http-equiv="refresh" content="0;url=http://example.com/"/>
;) seriously, just read about AJAX+jQuery instead:
http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/
I made a comment on a Wordpress blog and I noticed that after I submitted the comment, the top of the browser was flush with the top of my comment. In other words, the web page was auto-scrolled down to the top of my comment.
How can I do this? I am using a comment system with PHP / MySQL.
Thanks in advance,
John
Use an anchor and try to redirect adding the anchor to your link.
header('Location: http://www.example.com/questions/2301455#comment-54564');
should work.
Else you can do it with javascript by setting the hash property of the location object.
location.hash = '#comment-54564';
or using jQuery :
$(location).attr('hash', '#comment-54564');
You can use the following:
<a name="latest_comment">Comment goes here</a>
And then after a user posts a comment, redirect them to:
http://www.your-domain.com/your-uri#latest_comment
Check out this link under the "name attribute" section:
http://www.w3schools.com/html/html_links.asp