Forum Moderators: coopster
I know I need to create a form to retrieve the results and insert them into a database I am not sure
thanks
Mike
<form method="post" action="<?=$_SERVER['REQUEST_URI']?>">
<div>
<div>
<?
echo "<form name=jobinfo>\n";
echo "Type : : <font id=type><select>\n";
echo "<option value='0'>== Type ==</option> \n" ;
echo "</select></font>\n";
echo "Dept : <font id=dept><select>\n";
echo "<option value='0'>== Dept ==</option> \n" ;
echo "</select></font>\n";
echo "Priority : <font id=priority><select>\n";
echo "<option value='0'>==== Priority ====</option> \n" ;
echo "</select></font>\n";
?><script language=Javascript>
function Inint_AJAX() {
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} //IE
try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} //IE
try { return new XMLHttpRequest(); } catch(e) {} //Native Javascript
alert("XMLHttpRequest not supported");
return null;
};
function dochange(src, val) {
var req = Inint_AJAX();
req.onreadystatechange = function () {
if (req.readyState==4) {
if (req.status==200) {
document.getElementById(src).innerHTML=req.responseText; //ÃѺ¤èÒ¡ÅѺÁÒ
}
}
};
req.open("GET", "include/ajaxlist.php?data="+src+"&val="+val); //ÊÃéÒ§ connection
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=tis-620"); // set Header
req.send(null); //Ê觤èÒ
}
window.onLoad=dochange('type', -1);
</script>
<br />
<br />
<textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 60%" class="tinymce"><?php echo $sContent;?></textarea>
</textarea>
</div>
<!-- Some integration calls -->
<!--<a href="javascript:;" onmousedown="$('#elm1').tinymce().show();">[Show]</a>
<a href="javascript:;" onmousedown="$('#elm1').tinymce().hide();">[Hide]</a>-->
<div align="left" id="swfupload-control">
<p>Upload upto 5 files(jpg, png, gif, doc, docx, pdf,), each having maximum size of 5MB</p>
<input type="button" id="button" />
<p id="files" ></p>
<ol id="log"></ol>
</div>
<br />
<input type="submit" name="save" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</div>
</form></pre></code>
if you are new to php, i'd recommend learning to submit the form without the ajax. when you can do that, then move on to the "complicated" stuff.
strip out all the javascript and create a simple form with 2 or 3 fields:
<form action="submit.php" method="post">
<input type="text" name="title" value="">
<textarea name="text"></textarea>
<input type="submit" name="submit" value="save">
</form>
enter some data into the form and then when you click save, it will submit it to the page submit.php:
<?php
echo $_POST['title'];
echo '<br><br>';
echo $_POST['text'];
?>
all this does is show you exactly what data you are submitting and how you can retrieve it. you can then insert that data into mysql using an sql insert:
INSERT INTO mytable (title, text) VALUES ('$_POST['title']', '$_POST['text']');
once you get this one working, you can move onto the ajax. looking at the example above, the file include/ajaxlist.php is the one which receives the POST'ed data (as opposed to submit.php in the example above).
cheers
and the ajax multi file upload I know it is storing the info when a file is uploaded as it provides a link to the file I would like to store the file link as part of the form submit I was hoping somone might have worked on somthing simular
regards
Mike