Er hægt að senda POST variable með JavaScript? Ef svo er væri einhver til í að koma með flott dæmi?
Bætt við 19. febrúar 2007 - 21:11
Þá meina ég að ég er með breytu sem ég fékk úr prompt box og langar að senda hana áfram með post
<script type="text/javascript">
<!--
var post = prompt('What?');
var wher = prompt('Where?');
window.location="session.php?post=" + post + "&name=" + wher;
// -->
</script><?php
session_start();
if (!isset($_GET['post'])) die();
$_SESSION[$_GET['name']] = $_GET['post'];
header('Location: show.php?name='.$_GET['name'].'');
?><?php session_start(); echo $_SESSION[$_GET['name']]; ?>
function addPostdata(key, value)
{
var theForm = document.getElementById("from");
var newElement = document.createElement("input");
newElement.type = "hidden";
newElement.name = key;
newElement.value = value;
theForm.appendChild(newElement);
}