Reputation: 7053
When I type this:
<form method="post" action="../Thread/thread.php?threadID=".<?php echo $threadID; ?>."&page=".<?php echo $page; ?> >
I get this:
http://localhost/PoliticalForum/Thread/thread.php?threadID=
how can I encode the variables into the url to avoid such mistakes?
Upvotes: 0
Views: 202
Reputation: 140763
echo('<form method="post" action="../Thread/thread.php?threadID=' . $threadID . '&page=' . $page . '">');
You had problem with your quotes.
Edit:
$url = sprintf("../Thread/thread.php?threadID=%1s&page=%2s",$threadID,$page);
echo('<form method="post" action="'.$url .'">');
http://php.net/manual/en/function.sprintf.php
Upvotes: 3
Reputation: 4778
Your quotes are wrong, try this:
<form method="post" action="../Thread/thread.php?threadID=<?php echo $threadID; ?>&page=<?php echo $page; ?>">
Upvotes: 0
Reputation: 86346
Problem with quotes try this one
<form method="post" action="../Thread/thread.php?threadID=<?php echo $threadID; ?>&page=<?php echo $page; ?>" >
Upvotes: 2