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 8744471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:50:44+00:00 2026-06-13T11:50:44+00:00

I have a form where I display a select item and two other invisible

  • 0

I have a form where I display a select item and two other invisible inputs with some variable values that I need to pass to the same page at the press of the “Action” button. But I’m having the problem that those variables are city names like “New York”, so there is a space inside the name, and at the moment of passing the variable only the “New” gets passed; nothing after the space goes with it. I have read that there shouldn’t be any spaces in those variables, so how should I do this?

Here is my sample code:

// at the beginning of the code I get this variables pass from other pages

$pais=$_GET['pais']; 
$name=$_GET['nombre'];


// this is how I query my table to populate my select item

$SN=mysql_real_escape_string($name);
$SP=mysql_real_escape_string($pais);
$estadoquery = "SELECT * FROM `".$SP."` ORDER BY Estado ASC";
$estadoresult = mysql_query($estadoquery);


// this is how I make my form

<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="HIDDEN"  name=nombre  value="<? echo $SN ?>">
<input type="HIDDEN"  name=pais  value="<? echo $SP ?>">
  <th scope="col" align="center" valign="baseline" size="18px">

      <select name=estado  id="estado" style="font-size:24px">
       <option value="">Todos</option>
        <?
        while($rowp = mysql_fetch_array($estadoresult)) {
               $estado = $rowp['Estado'];
               $Se=mysql_real_escape_string($estado);
          ?>
        <option value=<?php echo $Se ?>>
        <?php echo $Se ?></option>
        <? } ?>
      </select>
  </th>
   <th scope="col" align="center" valign="baseline"> 
  <input type="SUBMIT"  name="ACTION" value="IR">
</th></form>


// and this is what the button action does

 if(@$_POST['ACTION']=='IR')
{
$pais = $_POST['pais'];
$name = $_POST['nombre'];
$estado = $_POST['estado'];
  $pais = mysql_escape_string($pais);
  $name = mysql_escape_string($name);
  $estado = mysql_escape_string($estado);
// this next echos are just to check my variables.
echo $pais;
echo $name;
echo $estado; // so here I can tell that this variable is not complete

}

And I have read that variables cannot be passed with spaces, why does my $pais variable “United States” gets passed with the space in between correctly?
Can someone tell me how to achieve this or how to transform my <option value=<?php echo $Se ?>> so it can pass the space?

  • 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-06-13T11:50:45+00:00Added an answer on June 13, 2026 at 11:50 am

    Per my comment above:

    The problem is that there are not quotes around the option values. Change it like so:

    <option value="<?php echo $Se ?>"> 
    

    and you’ll be good to go.

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

Sidebar

Related Questions

I have a requirement wherein I need to display on a User form, a
I have some code to display a long list of languages inside Rails form
I have an application that consists of two forms. One form displays data returned
I have a data-bound combobox on a Windows form. When I select an item,
I have a form in which I have a ComboBox control with two values.
I have two input boxes and two select boxes and would like to display
In a view that I have, I am using fields_for to display form data
I have a nested form that has a select dropdown menu. How can I
I have a multi-lingual page where I want to display form validation error in
I have a form and when this form is sent via AJAX, I display

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.