0

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?

3 Answers 3

3
 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

Sign up to request clarification or add additional context in comments.

2 Comments

+1 this way is using all PHP with the HTML inside the quotes, which seems to be what you were originally trying to do but got mixed up with the quotes
is there a function that can help me pu tall the variables and attach them to the file name?
2

Problem with quotes try this one

<form method="post"  action="../Thread/thread.php?threadID=<?php echo $threadID; ?>&page=<?php echo $page; ?>" >

Comments

0

Your quotes are wrong, try this:

<form method="post"  action="../Thread/thread.php?threadID=<?php echo $threadID; ?>&page=<?php echo $page; ?>"> 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.