...

View Full Version : Resolved Posting to a PHP page then having the current page update



RoMa
01-31-2011, 10:49 PM
I posted in the PHP forum about this and I'm starting to think (after other pointed out) that my PHP codes may not be the culprit here.. If someone could shed the light on what I'm doing wrong it would be greatly appreciated..

Thanks in Advance!!

Here's what I'm trying to do:

on (page1.php) submit a form that has 3 variables that the user inputs - these var's are sent to a seperate processing page (process.php) - but on Page 1 there is a current list of things the user already added and when they add another item I want it added to the very last line..

Ideally, this is what I'm wanting to do: http://demo.tutorialzine.com/2010/03/ajax-todo-list-jquery-php-mysql-css/demo.php

However, I want to be able to add the values before it's added, be able to edit each variable (per id (IE: Name, Number, Description) - not just 1 object all together) and I don't want the "repositioning" feature that this has.

Here's my JS


$(function() {
$('.error').hide();
$(".button").click(function() {
// validate and process form here

$('.error').hide();
var p_name = $("input#p_name").val();
if (p_name == "") {
$("label#p_name_error").show();
$("input#p_name").focus();
return false;
}
var p_desc = $("input#p_desc").val();
if (p_desc == "") {
$("label#p_desc_error").show();
$("input#p_desc").focus();
return false;
}
var p_numb = $("input#p_numb").val();
if (p_numb == "") {
$("label#p_numb_error").show();
$("input#p_numb").focus();
return false;
}

var p_name = $("input#p_name").val();
var p_desc = $("input#p_desc").val();
var p_numb = $("input#p_numb").val();
//submit the form here
var dataString=new Array(p_numb, p_name, p_desc)
//var dataString = 'p_name='+ p_name + '&p_desc=' + p_desc + '&p_numb=' + p_numb;
//alert (dataString);return false;
$.ajax({
type: "POST",
url: "addPort.php",
data: dataString,
success: function() {
$('#contact_form').html("<div id='message'></div>");
}
});
return false;
});
});

Here's a link to my PHP Post (which has more coding listed) http://www.codingforums.com/showthread.php?t=216996



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum