1) Script Title:
Dynamic Ajax Content
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamici...jaxcontent.htm
3) Describe problem:
I am now using the script in a form to post data back to the same page in a div tag and process my form data with the php. When I click submit the page reloads fine but it does not send the form POST data to the page and therefore does not process the form inputs, if i remove the ajaxpage call and submit the page it all works fine, how can I send my input post data back to the page using the ajaxpage call?
Here is the code
Code:<?php session_start(); // include definitions require_once('../scripts/defs.php'); // set time variable for form processing protection $current=time(); // define index site link $site=LINKPRE."index.html"; // check for admin user if ($_SESSION['type'] != 'admin') { header("Location: $site"); } // check for get page variable if (!isset($_GET['page']) || (!in_array($_GET['page'], array('home', 'profile', 'contact', 'suppliers')))) { header("Location: $site"); } else { $page=$_GET['page']; $pageSET=$_GET['page'].".inc"; } // check for time session variable // if (!isset($_SESSION['timenode']) || ($_SESSION['timenode'] != $_POST['setTime'])) { // check for and process mouseForm submit if (isset($_POST['mchange']) && isset($_POST['mouse']) && $_POST['mouse'] != '') { $mouseSET=$_POST['mouse']; $file=IMGINC.$pageSET; $data=file($file); // build new file $rebuild=$data[0]; $rebuild.=$mouseSET; $rebuild.=$data[2]; // write new file $new=fopen($file,"w"); fwrite($new,$rebuild); fclose($new); // set time check session $_SESSION['timenode']=$_POST['setTime']; } // check for and process mouseForm submit // } // Get home image date $file=IMGINC.$pageSET; $data=file($file); // load image data for preview $img=LINKPRE.IMG.$data[0]; $alt=$data[1]; // print options menu and info ?> <link href="admin.css" rel="stylesheet" type="text/css" /> <div id="bgIMGhead"> <div id="bgIMGtext"><b>Current Image For <?php echo ucfirst($page).$_SESSION['timenode'].$_POST['mouse']; ?> Page</b><div id="bgIMGname"><b>Filename:</b> <?php echo $data[0]; ?></div> <div id="bgIMGmouse"> <form method="POST" action="javascript:ajaxpage('bgIMG.php?page=<?php echo $page; ?>', 'rightContent');" name="mouseForm"> <input name="mouse" type="text" size="60" value="<?php echo $data[1]; ?>" /> <input type="hidden" name="setTime" value="<?php echo $current; ?>" /> <input type="submit" name="mchange" value="Change Text" /> <b>( Changes Mouse Over Text )</b> </form> </div> </div> <div id="bgIMGswap"> <form method="POST" action="javascript:ajaxpage('bgIMG.php?page=<?php echo $page; ?>', 'rightContent');" name="change" enctype="multipart/form-data"> <input name="image_file" type="file" size="60" id="image_file" accept="image/jpeg" /> <input type="hidden" name="setTime" value="<?php echo $current; ?>" /> <input type="submit" name="pchange" value="Change Image" /> </form> </div> </div> <div id="showIMG"><img src="<?php echo $img; ?>" alt="<?php echo $alt; ?>" title="<?php echo $alt; ?>" width="776px" border="0px"></div>



Reply With Quote


Bookmarks