Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
25% Recurring Discount on NVMe VPS
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
CloudLinux
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Is Select option value not working with ajax when selected value is Php array variable?

I am now confused that if i use php array for a selected option, will it not send variable value to ajax? Because i am stuck with this for last 40 hours (-6hours sleeping). Here is my ajax code and html form with php select option:
Code link with javascript
when i tried to submit form its getting everything on php file except selected value of select option.
So the problem is ajax sending exactly php variable $namedoclist not the selected value. I expect DR1 or DR2 or DR3 whatever i select which is showing via $namedoclist. Was it problem with my ajax code? or it is not possible to pass the php variable value via ajax when using html select option?

Comments

  • edited October 2020
    echo'<option value="$namedoclist">'.$namedoclist.'</option>';
    

    When you echo a string using a single quote, it will output the literal value, which is:

    <option value="$namedoclist">
    

    Try:

    echo "<option value=\"$namedoclist\">$namedoclist</option>";
    

    instead.

    Thanked by 1yoursunny
  • sandanistasandanista Member
    edited October 2020

    or

    echo'<option value="' . $namedoclist . '">'.$namedoclist.'</option>';

    Thanked by 1RickBakkr
Sign In or Register to comment.