Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6990061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:17:47+00:00 2026-05-27T19:17:47+00:00

<?php $current_subject = $_GET[‘subject_id’]; $current_content = $_GET[‘note_id’]; echo <form method=\post\ action=mainpage.php?subject_id=.$current_subject.&note_id=.$current_content.>; ?> <input type=’text’

  • 0
<?php

$current_subject = $_GET['subject_id'];
$current_content = $_GET['note_id'];

echo "<form method=\"post\" action=mainpage.php?subject_id=".$current_subject."&note_id=".$current_content.">";

?> 
  <input type='text' name='list_item' value=''>
  <input type='submit' name="new_item" value="New Item">   
</form>

The problem is that when one of the GET variables is two words the link doesn’t write it that way. So for example if $current_subject="Advanced Chemistry" and $current_content="Valence Electrons" the link will come out as:

<form method=​"post" action=​"mainpage.php?subject_id=Advanced" chemistry&note_id=​"Valence" electrons>​
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:17:48+00:00Added an answer on May 27, 2026 at 7:17 pm

    You need to urlencode() the variables like so:

    <?php
    
    $current_subject = $_GET['subject_id'];
    $current_content = $_GET['note_id'];
    
    $subject = urlencode($current_subject);
    $content = urlencode($current_content);
    
    $action = "mainpage.php?subject_id=" . $subject . "&note_id=" . $content;
    
    ?>
    
    <form method="post" action="<?php echo $action; ?>">
      <input type="text" name="list_item" value="">
      <input type="submit" name="new_item" value="New Item">   
    </form>
    

    Also, you should get in the habit of validating that data. You probably want to check that they are integers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all, I have a basic HTML contact form that goes to a .php
Currently I'm working on a textbook ordering html form with PHP User shown a
I have the current PHP: $thisarray[] = #000; SetProfileField('usercss', $USER->id, implode(',',$thisarray)); Which writes #000
Here is how our current php development solution is set up: Each developer work
Using Php I would like to extract the current Url of a page including
Trying to display current time with PHP (using this ): $date = date('m/d/Y h:i:s
My current project is in Rails. Coming from a Symfony (PHP) and Django (Python)
This is my current .htaccess Options +FollowSymLinks DirectoryIndex index.php RewriteEngine On RewriteBase /product/ RewriteCond
How to create simple PHP COMET server page displaying current time? I need code
When calling php via cli, the current directory is NOT changed to the one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.