PDA

View Full Version : PHP Form w/ Javascript Validation & then submit?


tek420angel
12-23-2004, 10:27 AM
Hi.. I need help with submitting a form. I made some changes to an existing form written in HTML, rewrote everything in PHP and assumed that my form method, post, submit stuff would all work the same. It isn't and I don't know why. The form, after the fields are populated, goes through a JS Validation and then is supposed to send off to another php file for processing into an SQL database. While this worked fine in the first edition of this form, it isn't when it's written now in php. I'm not sure what code needs to be posted, but this is my form method statement:



print ("<form method=\"<?php echo $editFormAction; ?>\" method=\"POST\" name=\"formInsertRecord\" onsubmit=\"return validateForm(this)\">\n");


It doesn't work that way, nor this way:

[code]
print ("<form method=\"echo $editFormAction\" method=\"POST\" name=\"formInsertRecord\" onsubmit=\"return validateForm(this)\">\n");


and not this way either:



print ("<form method=\"$editFormAction\" method=\"POST\" name=\"formInsertRecord\" onsubmit=\"return validateForm(this)\">\n");


and as most recently suggested to me, not this way either:


print (echo "<form method='".$editFormAction."' method='post' name='formInsertRecord' onsubmit='return validateForm(this)'>\n";);

gsoft
12-23-2004, 06:14 PM
Your already in PHP when using this form why use print and echo at the same time wouldnt this just work


echo '<form method="'.$editFormAction.'" method="post" name="formInsertRecord" onsubmit="return validateForm(this);">\n';