سؤال

I have written a script in php to replace in newtopic button in phpbb3

in other question, a user says me this:

In your submit.php, you can retrieve the forum ID using $_GET['f']. Now, to pass it on to application.php, you can use a hidden input field:

<form  method="post" action="application.php" accept-charset="utf-8" >
  $id = htmlspecialchars($_GET['f']); 
<input type="hidden" name="forum_id" value="<?php echo $id; ?>"/>

When you click on the submit button, the forum ID value will also get POSTed, and you'll be able to retrieve it in application.php code using the $_POST['forum_id'].

and my code goes as here:

<form  method="post" action="application.php" accept-charset="utf-8" >
   $id = htmlspecialchars($_GET['f']); 
  <input type="hidden" name="forum_id" value="<?php echo $id; ?>"/>
  .............
<fieldset class="submit-buttons">
               <input value="Submit" class="button2" type="submit">
           </fieldset>

This code is embedded in submit.php to use phpbb3 template.

and application.php goes as here

So I click on new topic button, and I redirect to submit.php?mode=post&f=3 and in that php there is embedded the html, the problem is that with the solution, I receive the next error:

"The forum you selected does not exist" and the addresswar goes as: viewforum.php?f=&sid=a69fb9f491d2adc11c4be3a6dac02774

so I think that forum_id (in thos case is "3" (&f=3) is not correctly sent throught php scripts

I would appreciate some help

هل كانت مفيدة؟

المحلول

You need to add $id = htmlspecialchars($_GET['f']); inside the <?php ?> tag,

<?php  $id = htmlspecialchars($_GET['f']); ?>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top