Question

i want to pass value that contain question mark

i have 2 php example example1.php and example2.php

in my example1.php the code like this

 <a href="example2.php?title=what is this?" />

in my example2.php the code like this

 <php
 if(isset($_GET['title']))
 {
  $title = $_GET['title'];
  echo $title;
 }

 ?>

but in example2.php the title become like this what is this the question mark disappear

i already try to use str_replace my question mark become like this what is this"?" but still same at example2.php the question mark disappear

please help me how to pass value that contain question mark

thanks

Was it helpful?

Solution

change <a href="example2.php?title=what is this?" /> into

<a href="example2.php?title=what is this%3F" />

then add

<?php
 if(isset($_GET['title']))
 {
  $title = $_GET['title'];
  echo $title;
 }

 ?>

this will work for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top