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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:49:54+00:00 2026-06-03T09:49:54+00:00

I have a variable like Doctor and Surgical I take this value from Mysql

  • 0

I have a variable like “Doctor and Surgical” I take this value from Mysql database and store it in a variable. When I echo this variable it gives me only “Doctor”
Can anyone tell me how can I take the above value retrieved from Mysql as an entire variable…

EDIT

Please find the code below

query.php
<form action="process.php" method="post">
<select name="cat">
<?php
$sql="select distinct Category from tbl_1 order by Category asc";
$query=mysql_query($sql);

while($row=mysql_fetch_array($query))
{

 echo "<option value=".$row[Category].">".$row[Category]."</option>";
}
?>
</select>
<select name="station">
<?php
$sql_1="select distinct Station from tbl_1 order by Station asc";
$query_1=mysql_query($sql_1);

while($row=mysql_fetch_array($query_1))
{

echo "<option value=".$row[Station].">".$row[Station]."</option>";
}
?>
</select>
<input name="C" type="submit" />
</form>



process.php

$myValue =$_POST['cat'];
$myStation=$_POST['station'];

echo $myValue;
echo "<br/>";
echo $myStation;

$mySqlStm ="SELECT Name FROM tbl_1 WHERE Category='$myValue' and Station='$myStation'";

$result2 = mysql_query($mySqlStm) or die("Error:mysql_error()"); 

if(mysql_num_rows($result2) == 0){ 
echo("<br/>no records found"); 
} 
ELSE 
{ 
echo "<table border='1'>"; 

//ECHO THE RECORDS FETCHED
while($row = mysql_fetch_array($result2)) 
{ 
echo "<tr>"; 

echo "<td>" . $row['Name'] . "</td>"; 
}}

Here when I echo $myValue it gives me “Doctor” instead of “Doctor and Surgeon”
I need “Doctor and Surgeon as an entire variable.

  • 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-03T09:49:55+00:00Added an answer on June 3, 2026 at 9:49 am

    You need to quote the value properly:

     echo "<option value='".$row[Category]."'>".$row[Category]."</option>";
    

    With your current code, if you look at the source you will probably see something like this:

     <option value=Some Category>Some Category</option>
    

    But with proper quotation you’ll see the correct value.

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

Sidebar

Related Questions

So let's say I have variable like this one: $q = DB::select('id')->from('reports')->where('field', '=', 'value');;
i have value in php variable like that $var='2.500000550'; echo $var what i want
I have a variable that I got out of the database table like this:
I have a variable that looks like this: $var = Dropdown\n Value 1\n Value
i have a variable like the following and i want a function to only
I have a variable declared like this in a class: Entity *array[BOARD_SIZE][BOARD_SIZE]; I need
I have a variable declared like this: @property (nonatomic, retain) NSMutableArray *aInfo; At the
I have some text that is stored in a variable like this: <div class=foo>text
i have a variable like this: set file=c:\dir\foo\bar\file.txt how can i get just the
This should be a very simple rails question. I have a variable like the

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.