Reputation: 2751
I don't know whats wrong with this code but it is not working. I changed form method to post and get but nothing worked. I want to submit this form to DB.
popup.html:
<form id='myForm' action='savenewfeed.php' method="get">
URL:
<input class= 'vals' type="text" name="feed" id="url">
<br>
Title :
<input class= 'vals' type="text" name="title" id="title">
<br>
Channel:
<select class= 'vals' name='pid'>
<option value="2">Big</option>
<option value="3">H</option>
<option value="4">T</option>
</select>
<button id='sbmt'>Submit</button>
</form>
manifest:
{
"manifest_version": 2,
"name": "One-click Kittens",
"description": "This extension gets current url of browser",
"version": "1.0",
"permissions": [
"tabs",
"cookies",
"http://*/*",
"http://*/",
"https://*/*"
],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
}
}
popup.js:
function myAlert(){
document.getElementById('myForm').submit();
}
document.addEventListener('DOMContentLoaded', function () {
document.getElementById('sbmt').addEventListener('click', myAlert);
});
when i click the button, my php code appears in chrome extension, whereas , that php code to submit data works perfectly in simple web app.
Upvotes: 0
Views: 1621
Reputation: 306
change form action to absolute url of your submit script. don't use relative path. for example
<form id='myForm' action='http://localhost.com/mydir/savenewfeed.php' method="get">
Upvotes: 1