Here is my complete script... You can just create test.php and throw it in.
It looks like this:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script language="javascript" type="text/javascript" src="<?php echo '' . $site_url . '' ?>includes/libary.js"></script>
<script type="text/javascript">
function saveScrollPositions(theForm) {
if(theForm) {
var scrolly = typeof window.pageYOffset != 'undefined' ? window.pageYOffset : document.documentElement.scrollTop;
var scrollx = typeof window.pageXOffset != 'undefined' ? window.pageXOffset : document.documentElement.scrollLeft;
theForm.scrollx.value = scrollx;
theForm.scrolly.value = scrolly;
}
}
</script>
</head>
<body>
<div style="padding: 200px 0 200px 0;">
<?php
$notes = $_POST['internal_notes'];
$bonid = $_POST['reciept_id'];
echo '<form name="notes" method="post" action="test.php" onsubmit="return saveScrollPositions(this);">';
echo '<input type="hidden" name="scrollx" id="scrollx" value="0" />';
echo '<input type="hidden" name="scrolly" id="scrolly" value="0" />';
echo '<input type="hidden" name="reciept_id" value="' . $_POST['reciept_id'] . '">';
echo '<textarea name="internal_notes">';
if ($_POST['internal_notes'] == '') {
echo 'No internal notes.';
} else {
echo $_POST['internal_notes'];
}
echo '</textarea>';
echo '<input type="submit" name="submit" value="Save">';
echo '</form>';
$scrollx = 0;
$scrolly = 0;
if(!empty($_REQUEST['scrollx'])) {
$scrollx = $_REQUEST['scrollx'];
}
if(!empty($_REQUEST['scrolly'])) {
$scrolly = $_REQUEST['scrolly'];
}
?>
</div>
<script type="text/javascript">
window.scrollTo(<?php echo "$scrollx" ?>, <?php echo "$scrolly" ?>);
</script>
This works fine. When i press Save, it posts and the page returns to the scroll position.
However i want to remove the submit-button, and insetad use onblur="submit();" on the "internal_notes" field.
However... This does not work. How do I combine the submit and the "saveScrollPositions()" function?
If your js functions are ok, I really would like to see submit(), try this:
1) add to your form an ID, i.e: id='notes'
2) change de onblur by this code:
onblur="saveScrollPositions(document.getElementById('notes')); submit();"
here you can see a functional example
Related
we have a program that has two button(approve and disapprove). Our problem is when i hit on the button, the value on the prompt doesn't save on the database.
ServiceRequest.php
<?php
session_start();
if(!isset($_SESSION['user']) || !isset($_SESSION['lname']) || !isset($_SESSION['fname']) || !isset($_SESSION['lname']) || !isset($_SESSION['pass']) || !isset($_SESSION['assign']) || !isset($_SESSION['department']) || !isset($_SESSION['branch']) || !isset($_SESSION['province']) || !isset($_SESSION['position']))
{
header('Location:login.php');
}
include 'config.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="image/fblogo.ico">
<title>FB | ITS&CMS</title>
<link href="dist/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">
<!-- <link href="signin.css" rel="stylesheet"> -->
<link rel="stylesheet" type="text/css" href="dist/css/jquery.dataTables.min.css"></script>">
<link rel="stylesheet" type="text/css" href="css/body.css">
<script src="assets/js/ie-emulation-modes-warning.js"></script>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="assets/js/ie10-viewport-bug-workaround.js"></script>
<script src="dist/js/jquery-1.12.4.js"></script>
<script src="dist/js/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function () {
$('#otable').DataTable({
"searching": false,
"order" : [[ 5, "desc" ]]
});
$("#search").click(function(){
$("#searchPanelWrap").slideToggle("slow");
});
$("#searchServiceRequests").click(function(){
var filterVal ="";
filterVal = "srfno=" + $('#srf').val() + "&branch=" + $('#branch').val() + "&dept=" + $('#dept').val() + "&reqf=" + $('#datereqfrom').val() + "&reqt=" + $('#datereqto').val() + "";
document.location.href = 'servicereq.php?s=1&' + filterVal;
});
});
</script>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<?php
include "header.php";
?>
</nav>
<br><br><br><br><br>
<div class="form">
<center>
<fieldset id="fieldsetform">
<div class="form"><br><br>
<center><h4>Service Request Forms</h4></center>
<ul class="tab-group"><br>
<button style="width: 150px; height: 50px;" type="button" class="btn btn-success" value="Service">Service Request</button>
<button style="width: 150px; height: 50px;" type="button" class="btn btn-danger" value="Service">Close Request</button>
<button class="btn" style="width: 50px; height: 50px;" value="Search" id="search"><span class="glyphicon glyphicon-filter"></span></btn>
</ul>
<div id="searchPanelWrap" style="padding-bottom:10px; display:none;">
<input style = "text" placeholder = "SRF No." id="srf"/>
<input style = "text" placeholder = "Branch" id="branch"/>
<input style = "text" placeholder = "Department" id="dept"/>
Request Date From: <input style = "text" type = "date" value="" id="datereqfrom"/>
Request Date To: <input style = "text" type = "date" value="" id="datereqto"/>
<button class="btn btn-default" id="searchServiceRequests">Search</button>
</div>
<form action="downloadfile.php" method="get"></form>
<?php
//if(!$uname == 'uname' && !$pass = 'pass'){
include 'dbconn.php';
if($_SESSION['assign']!="Main Approver"){
$clause = "dept = '".$_SESSION['department']."' AND city='".$_SESSION['branch']."' AND type != '".$_SESSION['assign']."' AND status = 'PENDING' ";
}else{
$clause = "status = 'PENDING' ";
}
if($_GET["s"] == "1"){
$srf = $_GET["srfno"];
$branch = $_GET["branch"];
$dept = $_GET["dept"];
$datereqfrom = $_GET["reqf"];
$datereqto = $_GET["reqt"];
$srfFilter = "";
$brFilter = "";
$deptFilter = "";
$reqFilter = "";
if($srf != ""){
$srfFilter = "AND SRFNo = '".$srf."' ";
}
if($branch != ""){
$brFilter = "AND city = '".$branch."' ";
}
if($dept != ""){
$deptFilter = "AND dept = '".$dept."' ";
}
if($datereqfrom != "" && $datereqto != ""){
$reqFilter = "AND RequestDateTime BETWEEN '".$datereqfrom." 00:00:00.000' AND '".$datereqto." 23:59:59.999' ";
}
$addFilter = $srfFilter.$brFilter.$deptFilter.$reqFilter;
}else{
$addFilter = "";
}
$record= getAllServicePending($clause.$addFilter);
echo '<table id="otable" class="table table-striped">';
echo '<thead>';
echo '<th>SRF No.</th>';
echo '<th>Last Name</th>';
echo '<th>First Name</th>';
echo '<th>Branch</th>';
echo '<th>Department</th>';
echo '<th>Date Requested</th>';
echo '<th>Attached File</th>';
echo '<th>Service Form View</th>';
echo '<th>Status</th>';
echo '<th>Action</th>';
echo '</thead>';
echo "<tbody>";
foreach($record as $r){
$i=0;
echo '<tr>';
$idno;
foreach($r as $fields){
if($i==0) $idno=$fields;
//echo '<td>'.strtoupper($fields).'</td>';
$i++;
}
$files = $r['file'];
echo '<td>'.$r['SRFNo'].'</td>';
echo '<td>'.$r['lastreq'].'</td>';
echo '<td>'.$r['firstreq'].'</td>';
echo '<td>'.$r['city'].'</td>';
echo '<td>'.$r['dept'].'</td>';
echo '<td>'.$r['RequestDateTime'].'</td>';
echo '<td>'.$r['file'].'</td>';
echo '<td>Service Request</td>';
echo '<td>'.$r['status'].'</td>';
echo '<td>
<button type="button" class="btn btn-success" onclick="window.location.href=`approveserv.php?idno='.$idno.'&status=approve`" style="width:136px;"><span class="glyphicon glyphicon-thumbs-up" style="padding-right:5px"></span>APPROVE</button><br>
<button type="button" class="btn btn-danger" onclick="window.location.href=`approveserv.php?idno='.$idno.'&status=disapprove`" style="width:136px;"><span class="glyphicon glyphicon-thumbs-down" style="padding-right:5px"></span>DISAPPROVE</button>
</td>';
echo '</tr>';
}
echo "</tbody>";
echo '</table>';
//}
?><br><br>
</div>
</fieldset>
</center>
</div><?php
include "footer.php";
?>
</body>
</html>
Here is how I used the prompt(), this will just perform the SQL for approve and disapporve but the value of the prompt does not store to the database.
SQL query:
approveserv.php<?php
session_start();
if(!isset($_SESSION['user']) || !isset($_SESSION['lname']) || !isset($_SESSION['fname']) || !isset($_SESSION['lname']) || !isset($_SESSION['pass']) || !isset($_SESSION['assign']) || !isset($_SESSION['department']) || !isset($_SESSION['branch']) || !isset($_SESSION['province']) || !isset($_SESSION['position']))
{
header('Location:login.php');
}
include ('dbconn.php');
$idno = $_GET["idno"];
$reqstat = $_GET["status"];
$s = ret_status_service($idno);
$user = $_SESSION['user'];
$db = site_db();
if($reqstat=="approve"){
$sql = "UPDATE services SET status ='APPROVED', ApprovalDateTime = CURRENT_TIMESTAMP(), ApprovedBy = '".$user."' WHERE ser_id = ?";
}else{
$sql = "UPDATE services SET status ='DISAPPROVED', ApprovalDateTime = CURRENT_TIMESTAMP(), ApprovedBy = '".$user."' WHERE ser_id = ?";
}
$s = $db->prepare($sql);
$s->execute(array($idno));
$db = null;
echo "<script>if(prompt('Successfully ${reqstat}d request.')){document.location.href='servicereq.php?s=0'};</script>";
// header('location:servicereq.php');
?>
If your concerns are how to get the input of prompt dialog and send it to servicereq.php. You could refer to the following code:
//servicereq.php - to get the prompt message from approveserv.php and store it to database
if(isset($_REQUEST['prompt_msg'])){
$prompt_msg= $_REQUEST['prompt_msg'];
// you could continue to store it in the database
}
//approveserv.php - to output the javascript and get the prompt message and send it to servicereq.php
echo "<script>if(prompt_msg=prompt('Successfully ".$reqstat."d action request.')){document.location.href='servicereq.php?prompt_msg='+prompt_msg+'&s=0'};</script>";
Note: I suppose you could manage to store the prompt msg to the database, so I didn't write the code here.
Here is a further material for how to use prompt.
I am working on a website using CKEditor. I tried to incorporate the Image Uploader plugin (https://ckeditor.com/cke4/addon/uploadimage). When I try to copy in the image, I get an error: "Cannot read property 'getEditor' of undefined". I am fairly certain that I installed the files correctly because I am able to paste a photo into the textarea, but it is unable to post. The documentation (https://docs.ckeditor.com/ckeditor4/docs/#!/guide/dev_file_upload) of the plugin mentioned a lot of different code that the plugin requires, and it is likely that I am missing those files however the documentation is not very clear and is difficult to understand. If the problem is that I am missing those files, I would greatly appreciate it if someone could explain it to me. Here is the code of my file I am using:
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
require_once('../utils.php');
$access = $_REQUEST['access'];
$selectedPost = $_REQUEST['selectedPost'];
$submit = $_REQUEST['submit'];
$create = $_REQUEST['create'];
$delete = $_REQUEST['delete'];
$save = $_REQUEST['save'];
?>
<html>
<head>
<style>
body
{
background-image: url('../imgs/background.jpg');
text-align: left;
}
h2 {
color: #880000;
}
#wrapper
{
font-family: arial;
padding-top: 50px;
padding-bottom: 50px;
padding-left: 20px;
padding-right: 20px;
background: #FFFFFF;
width: 800px;
}
</style>
<script type="text/javascript" language="javascript" src="ckeditor/ckeditor.js"></script>
</head>
<body>
<div id="wrapper">
<?php
// PRINTING OUT PAGE STUFF
echo '<h2>Manage News Posts</h2>';
// Boot you out if you lack the login stuff in the POST
if(!$access) {
echo '<h2>Invalid Login Credentials.</h2>';
echo 'Back';
}
// We are authenticated
else {
// Something was submitted. Do whatever we are trying to, then dump us back
// to the main post selection UI.
if($submit) {
if($create) {
$query = "INSERT INTO blog_posts VALUES (NULL, '" . $_REQUEST['postSubject'] . "', '" . $_REQUEST['postBody'] . "', CURRENT_DATE)";
$insertPost = doQuery($query);
$query = '';
if($insertPost) {
echo '<i><h4>New Post Created!</h4></i>';
}
else {
echo '<i><h4>Error encountered during New Post creation!</h4></i>';
}
}
else if ($save) {
$query = "UPDATE blog_posts SET subject = '" . $_REQUEST['postSubject'] . "', body = '" . $_REQUEST['postBody'] . "' WHERE post_id = " . $selectedPost;
$updatePost = doQuery($query);
$query = '';
if($updatePost) {
echo '<i><h4>Post Updated Successfully!</h4></i>';
}
else {
echo '<i><h4>Error encountered during post update!</h4></i>';
}
}
else if ($delete) {
$query = "DELETE FROM blog_posts WHERE post_id = " . $selectedPost;
$deletePost = doQuery($query);
$query = '';
if($deletePost) {
echo '<i><h4>Post Deleted.</h4></i>';
}
else {
echo '<i><h4>Error encountered during deletion!</h4></i>';
}
}
$selectedPost = false;
$save = false;
$create = false;
$delete = false;
}
// Nothing selected, show the selection page.
if(!$create && !$selectedPost) {
echo '<form method="post" action="admin_posts.php?access=1">';
$query = "SELECT * FROM blog_posts ORDER BY post_id ASC";
$all_posts = getResults($query);
// Lay out selections
foreach($all_posts as $post) {
echo '<input type="radio" name="selectedPost" value="' . $post['POST_ID'] . '"/>' . ' ' . $post['SUBJECT'] . ' - (Posted on ' . $post['POST_DATE'] . ')<br/>';
}
echo '<input type="submit" value="Select" />';
echo '</form>';
// Create post button, gets its own form.
echo '<br/><br/>';
echo '<form method="post" action="admin_posts.php?access=1&create=1">';
echo '<input type="submit" value="Write New Post">';
echo '</form>';
// Back button
echo 'Back';
}
// End initial "nothing selected" box
// Something is selected, display its info for editing.
else {
echo '<br/>';
$post_subject = '';
$post_body = '';
if(!$create) {
$query = "SELECT * FROM blog_posts WHERE post_id = $selectedPost";
$post_data = getSingleRow($query);
$post_subject = $post_data['SUBJECT'];
$post_body = $post_data['BODY'];
}
// Print out the dialogue for creating and editing post
echo '<form method="post" action="admin_posts.php?access=1&submit=1">';
echo '<h4>Subject</h4>';
echo '<input name="postSubject" type="text" value="' . $post_data['SUBJECT'] . '" size=100/>';
echo '<br/>';
echo '<h4>Post Body</h4>';
echo '<textarea id="postBody" name="postBody" type="text" rows="25" cols="75">' . $post_data['BODY'] . '</textarea>';
echo '<br/><br/>';
if($create) {
echo '<input type="hidden" name="saveNewPost" value="1">';
echo '<input type="hidden" name="create" value="1">';
}
else {
echo '<input type="hidden" name="selectedPost" value="' . $selectedPost . '">';
echo '<input type="hidden" name="save" value="1">';
}
echo '<input type="submit" value="Save Post" />';
echo '</form>';
// Delete button. Only if you are editing.
// Gets its own submit form.
if(!$create) {
echo '<form method="post" action="admin_posts.php?access=1&submit=1&delete=1" onsubmit="return confirm(\'Are you sure you want to delete this post?\');">';
echo '<input type="hidden" name="selectedPost" value="' . $selectedPost . '">';
echo '<input type="submit" value="Delete Post">';
echo '</form>';
}
echo '<br/><br/>';
// Back button
echo 'Back';
}
}
?>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript">
bkLib.onDomLoaded(function()
{
CKEDITOR.replace( 'postBody' );
});
</script>
</div>
</body>
</html>
I have a HTML TextBox on my web page that show number of current question (A small web page to answer some question), I want to make shortcut to a question that users want by type number of question in TextBox.
I use this code below but this not work correctly.
For example all questions are 8 and when I enter 15 in TextBox and press Enter, if clause don't work and Question variable set with 15.
I use alert function to trace it and I understand that if clause don't work correctly. Can somebody check it and guide me?
This is all of my code:
<?php
$All = 8;
$URL = "http://localhost/Test.php";
if(isset($_GET["edtQuestionNo"])){
$QuestionNo = $_GET["edtQuestionNo"];
}else{
$QuestionNo = 1;
}
?>
<html>
<head>
<title>Test Page</title>
<script type="text/javascript">
function KeyPress(e, URL, All){
if(e.keyCode === 13){
var Question = document.getElementsByName("edtQuestionNo")[0].value;
if(Question > All){
Question = All;
alert(All + " " + Question + " yes");
}
else{
alert(All + " " + Question + " no");
}
window.open(URL + "?edtQuestionNo=" + Question,"_self");
}
}
</script>
</head>
<body>
<form action="Test.php" method="get" name="FRMQuestion">
<label>Enter question number : </label>
<input type="text" name="edtQuestionNo" id="QuestionNo" value="<?php echo $QuestionNo; ?>"
onkeypress="KeyPress(event,'<?php echo $URL; ?>','<?php echo $All; ?>')">
<br>
<label>Question number is : <?php echo $QuestionNo; ?></label>
</form>
</body>
</html>
I solve it
1. I have to use parseInt function for comparing All and Question value. because they are in different type.
2. I put Question value (after computing) in HTML TextBox again and then open URL.
My code is:
<?php
$All = 8;
$URL = "http://localhost/Test.php";
if(isset($_GET["edtQuestionNo"])){
$QuestionNo = $_GET["edtQuestionNo"];
}else{
$QuestionNo = 1;
}
?>
<html>
<head>
<title>Test Page</title>
<script type="text/javascript">
function KeyPress(e, URL, All){
if(e.keyCode === 13){
var Question = document.getElementsByName("edtQuestionNo")[0].value;
if(parseInt(Question) > parseInt(All)){
Question = All;
}
document.getElementsByName("edtQuestionNo")[0].value = Question;
window.open(URL + "?edtQuestionNo=" + Question,"_self");
}
}
</script>
</head>
<body>
<form action="Test.php" method="get" name="FRMQuestion">
<label>Enter question number : </label>
<input type="text" name="edtQuestionNo" id="QuestionNo" value="<?php echo $QuestionNo; ?>"
onkeypress="KeyPress(event,'<?php echo $URL; ?>','<?php echo $All; ?>')">
<br>
<label>Question number is : <?php echo $QuestionNo; ?></label>
</form>
</body>
</html>
I still can't get the right flow for this. I know it's simple and i think that my code is right but still the alert message is showing when i hit the buy button even if the input box is null. What i wanted is that no alert message will show if the input box is null but if the input box is filled then that;s the only time where the alert message will show when button is clicked. Here is my code:
<?php
require_once('auth.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Athan Motorcycle</title>
<style type="text/css">
<!--
.style1 {
color: #000000;
font-weight: bold;
font-size: 24px;
}
-->
</style>
<!--<script type="text/javascript">
function validateForm()
{
var a=document.forms["abc"]["qty"].value;
if ((a==null || a==""))
{
alert("Please specify the quantity.");
return false;
}
}
</script>-->
</head>
<body>
<form action="saveorder.php" name="abc" method="post">
<input name="id" type="hidden" value="<?php echo $_SESSION['SESS_MEMBER_ID']; ?>" />
<input name="transcode" type="hidden" value="<?php echo $_SESSION['SESS_FIRST_NAME']; ?>" />
<table width="400" border="0" cellpadding="0" cellspacing="0">
<?php
if (isset($_GET['id']))
{
include('config.php');
$id=$_GET['id'];
$result = mysql_query("SELECT * FROM athan_products WHERE product_id = $id and status='available'");
$row3 = mysql_fetch_array($result);
echo '<tr>';
echo '<td width="80"><img alt="Motor" src="images/motor/'.$row3['product_photo'].'" /></td>';
echo '<td width="200"><span class="style1">'.'</span></td>';
echo '<td width="120"></span></td>';
echo '</tr>';
echo '<tr>';
echo '<td width="80"><input name="name" type="text" value="'.$row3['partsname'].'" readonly/><input name="ingre" type="hidden" value="'.$row3['product_ingredients'].'"/> <input name="ids" type="hidden" value="'.$row3['id'].'"/></td>';
echo '<td width="120"></span></td>';
echo '</tr>';
}
?>
</table>
<br />
<label style="color:#000000;">Qty:
<input type="number" min="1" id="qty" name="qty" required = "required" />
</label>
<br />
<table width="400" border="0" cellpadding="0" cellspacing="0" style="color:#000000;">
<tr>
<!--<td width="179">Size</td>-->
<td width="128">Price</td>
<td width="179">Description</td>
<td width="93">Selection</td>
</tr>
<?php
if (isset($_GET['id']))
{
include('config.php');
$id=$_GET['id'];
$result = mysql_query("SELECT * FROM athan_products WHERE product_id = $id");
while($row3 = mysql_fetch_array($result))
{
$resultq = mysql_query("SELECT * FROM inventory WHERE product_id LIKE '%".$id."%'");
//$resultq = mysql_query("SELECT * FROM inventory WHERE product_id LIKE =$id");
while($rows = mysql_fetch_array($resultq))
{
$qwerty=$rows['qtyleft'];
}
if ($qwerty !=0){
echo '<tr>';
//echo '<td>'.$row3['product_size_name'].'</td>';
echo '<td>'.$row3['price'].'</td>';
echo '<td>'.$row3['description'].'</td>';
echo '<td>'.'<input name="but" type="image" value="'.$row3['id'].'" src="images/button.png" onclick="return myFunction()" />'.'</td>';
echo '</tr>';
}
else
{
echo '"This Item is not Available"';
//echo '<td>'.'<h1>'.'"not available"'.'</h1>'.'</td>';
}
}
}
?>
</table>
</form>
<script type="text/javascript">
function myFunction()
{
var a=document.forms["abc"]["qty"].value;
if (a!=null || a!= ""){
alert("Item has been successfully added to your Cart");
}
}
</script>
</body>
</html>
Your OR should be an AND:
if(a!=null && a!= "")
Since a is not equal to null, the condition is true
Instead of checking for null or empty, you should check if a.length is 0
if(a.length !== 0){
// do stuff
}
Problem:
Trying to automatically generate a form and submit it without user interference.
Complete code:
<?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
$(document).ready(function()
{
var url = 'test.php';
var form = $('
<form action="' + url + '" method="post">' +
'<input type="text" name="Datafile" value="' + <?php echo "upload/".$_SESSION['txtfile'].""; ?> + '">' +
'<input type="text" name="Perspective" value="' + <?php echo implode(" ", $_SESSION['dimensions']); ?> + '">' +
'<input type="hidden" name="form_submitted" value="true">' +
'</form>
');
$('body').append(form);
$(form).submit();
});
</script>
</head>
<body>
</body>
</html>
It gives me first an error when looking at the source code that implode() parameters are wrong.
Desired solution:
The form should submit itself once it has been loaded.
Anyone who can spot what's wrong or why the form does not submit itself?
Since you are using jquery why aren't you just sending the data via post?
$.post( "test.php", { name: "<?php echo "upload/".$_SESSION['txtfile']; ?>" ,
Perspective: "<?php echo implode(" ", $_SESSION['dimensions']); ?>",
form_submitted : "true"} );
Can you try this,
<?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
function AutoSubmit(){
document.my_form.submit();
}
</script>
</head>
<body onLoad="AutoSubmit();">
<form action="test.php" name="my_form" id="my_form" method="post">
<input type="hidden" name="Datafile" value="<?php echo "upload/".$_SESSION['txtfile']; ?>">
<input type="hidden" name="Perspective" value="<?php echo implode(" ", $_SESSION['dimensions']); ?>">
<input type="hidden" name="form_submitted" value="true">
</form>
</body>
</html>
<?php session_start(); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
$(document).ready(function()
{
var url = 'test.php';
var form =
"<form action="+url+" method=\"post\"><input type=\"text\" name=\"Datafile\" value=\"<?php echo \"upload/\".$_SESSION[\'txtfile\'].\"; ?> \"><input type=\"text\" name=\"Perspective\" value=\" <?php echo implode(\" \", $_SESSION[\'dimensions\']); ?>\"><input type=\"hidden\" name=\"form_submitted\" value=\"true\"></form>";
$('body').append(form);
$(form).submit();
});
</script>
</head>
<body>
</body>
</html>
You forgot to load jQuery in document:
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>