- Joined
- Aug 22, 2023
- Messages
- 1
- Reaction score
- 0
I appreciate some help that is it possible to access the <p> tag name with $_GET variable in PHP?
<p id="my_p_name">
Lorem ipsum
</p>
<a href="https://somewebpage.com?pName=my_p_name">Lorem</a>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
</head>
<body>
<ul>
<li><a href="#">A</a></li>
<li><a href="#">B</a></li>
<li><a href="#">C</a></li>
</ul>
<p id="my_p_name"></div>
<script>
$(() => {
$('ul a').click((e) => {
e.preventDefault();
var letter = e.target.textContent.toLowerCase();
$('#my_p_name').load(`letter.php?selected=${letter}`);
});
});
</script>
</body>
</html>
<?php
echo "You chosen the letter {$_GET['selected']}!";
?>
with $_GET variable in PHP?
There is a slight difference between $_GET and $_POST.Perhaps use $-POST instead?
I'm afraid you are not understanding what I was suggesting! There is certainly a significant difference between $_GET and $_POST, although I inquired as to if he was familiar with these variables, and if he should experiment to ultimately receive a solution!There is a slight difference between $_GET and $_POST.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.