0

i can't get values from the HTML select menu to js and from there to sql... the problem is in the JS code - it's probably caused by bad syntax... or misplace values.....

here is the varibles from the JS file

var select = $('select.select').val();

here is the varibles from the PHP file

$select = filter_var($_POST['select.value'],FILTER_SANITIZE_STRING);

here is the SELECT menu from the HTML file

 <select name ="select" class="select">

<option disabled selected id="none"> -- select an option -- </option>
<option value="roy">roy</option>

here is the FULL code , the PHP code is in the Console area - because i didn't manage to upload the code correctly...

code Thanks Ahead !

2
  • Can you post your whole form? Are you remembering to use the <form> tags? Commented Jul 22, 2014 at 12:59
  • Sure - here is the complete code - jsbin.com/yufita/1/edit?html,js,console,output Commented Jul 22, 2014 at 13:00

1 Answer 1

1

$_POST uses name="select", so:

$select = filter_var($_POST['select'],FILTER_SANITIZE_STRING);
Sign up to request clarification or add additional context in comments.

7 Comments

You Probably right - but the JS code doesn't move to the PHP file... incase the JS is OK.....
here is the PHP varibles :$name = filter_var($_POST['name'],FILTER_SANITIZE_STRING); $email = filter_var($_POST['email'],FILTER_VALIDATE_EMAIL); $email = filter_var($email,FILTER_SANITIZE_EMAIL); $phone = filter_var($_POST['phone'],FILTER_SANITIZE_STRING); $select = filter_var($_POST['select'],FILTER_SANITIZE_STRING);
try to remove # from <form action="#"
dap.tci - Yes Ajax to post the data in PHP
The problem is only in the JS code (Jquery), the select var is causing the code to stop...
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.