1
I would like to validate the GET id without javascript, only with php. I’m having a hard time.
<a id="exemplo-'.$resultado['id'].' " href="pagina.php">
<?php
/*com javascript*/
$id = explode('-',$_POST['exemplo']);
$ext = end($id);
/*com O php se valida id assim?*/
$id = explode('-',$_GET['exemplo']);
$ext = end($id);
?>
Yes it is possible, believe me. If you come by GET check first if the key exists with
isset()
then see if the given value is a valid number, can be done with a cast orctype_digit()
.– rray
The problem is you can’t get the
id
of the link?– rray
yes @rray , I was following a tutorial, and in this tutorial get was validated with js . attr('post') but I want to validate with php
– David
Good afternoon, I don’t see any javascript where you wrote
/*com javascript*/
, could be clearer? What exactly does javascript have to do with this?– Guilherme Nascimento
because in javascript has the . attr('post') validating a $_post if I were to put the js would be very extensive @Guilherme Nascimento
– David
Sorry, this is not specified in the body of the question, we highly recommend you read this link: http://answall.com/help/mcve
– Guilherme Nascimento
@Guilherme Nascimento will not read , I’m in the stack since 2014 I know the rules , the array answered my question, ok thanks
– David
All right, no need to read, your question presents nothing about the use of
attr()
inside the body, this makes it very difficult to help, I’m glad @rray helped you and at the same time sad that unfortunately you do not accept well constructive criticism (nay I am talking about the link). I myself am here since 2014 and I attend every day and still make some mistakes, it is normal.– Guilherme Nascimento
turns out that I asked the question by cel @Guilherme Nascimento , I’m beginner in phpoo , I thought cool your initiative understand I mentioned javascript in the question without being in the code I saw a tutorial that validates a get with js , I wanted to do the opposite
– David
Friend, regardless of being php, java, c#, javascript, mysql, html or anything the problem is with the question asked, lacked details, just this, I’m just guiding you, so that in the next questions you can better convey the problem and with details, facilitating the side of who will answer, today fortunately there was a user ( @rray) with good will and interest in answering, but it is not always so when the question has no details or is a little confused. I hope you don’t mind. See you later.
– Guilherme Nascimento