I'm trying to use the GET method to pass a variable from one page to another

<?php
$id ++;
echo $id;
?>
<input type="hidden" name="quiz" value="venn" />
<?php
echo '<input type="hidden" name="id" value='.$id.'" />'
?>

In the URL it returns the value
http://localhost/moodle/logicquiz/quiz_start.php?answer1=&answer2=&answer3=&answer4=&quiz=venn&id=3%22

My question is this.......how can I get rid of the "%22" because I use the value given from the URL to obtain data from the database.

Thanks for your help
NH

try urldecode

$newurl = urldecode(http://localhost/moodle/logicquiz/quiz_start.php?answer1=&answer2=&answer3=&answer4=&quiz=venn&id=3%22);

urldecode decodes any %## encoding in a given string..

I'm trying to use the GET method to pass a variable from one page to another

<?php
$id ++;
echo $id;
?>
<input type="hidden" name="quiz" value="venn" />
<?php
echo '<input type="hidden" name="id" value='.$id.'" />'
?>

In the URL it returns the value
http://localhost/moodle/logicquiz/quiz_start.php?answer1=&answer2=&answer3=&answer4=&quiz=venn&id=3%22

My question is this.......how can I get rid of the "%22" because I use the value given from the URL to obtain data from the database.

Thanks for your help
NH

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.