By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,724 Members | 1,868 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,724 IT Pros & Developers. It's quick & easy.

Form data loss

P: 2

I am experiencing data loss while submitting the form. After submitting the form, the data goes to the next page( a .php file) where it has to be encrypted and inserted into the database. But the encryption function gets only a blank space. Can any one help me?
May 8 '07 #1
Share this Question
Share on Google+
4 Replies

Expert Mod 10K+
P: 14,534
This question is being moved to the PHP forum.

May 8 '07 #2

Expert 100+
P: 404

Can you post some more detail about the problem you have - lets have some of the code to take a look at too..

May 8 '07 #3

P: 2

Can you post some more detail about the problem you have - lets have some of the code to take a look at too..

Dear friend,

Thank you for your reply.

Herewith I have given sample coding.

In the first file, I have the following form fields,

<form onSubmit = "return validForm(this)" method = "post" action = "complete.php">

<select name = "cardtype">
<option value ="visa" selected>VISA</option>
<option value ="mastercard">Mastercard</option>
<option value ="switch">Maestro</option>

<input name = "name" type = "text">


In the action page (complete.php) I have,

$sql = "UPDATE orders SET
name = '".encryptvar($_POST['name'])."',
cardtype = '".encryptvar($_POST['cardtype'])."',
WHERE id = '".$_SESSION['order_insert_id']."'";

Most of the times the values are passed perfectly, encrypted and updated into the database. But some times no data is coming from the form and the table is getting updated. If I look for the values in the table, both fields(name, cardtype) have the encrypted value for a white space.

The strange thing is, even if the customer didn't enter the name and the form validation fails, the cardtype has to be 'VISA'. Because this is the one selected on the list by default. But this also come as a blank in the action page.

Do have any idea friend?

Thanks in advance.

May 9 '07 #4

Expert 100+
P: 404
Hi Nalls,

As with all these things I have more questions before we get to answers:

Can you post the php logic which deals with processing the form
I can see it is using a javascript validation - are you assuming the data returned is clean when the second script runs ?

As a wild guess - could the entries you are seeing on the database be from browsers with javascript disabled ? Or is it from users that have hit refresh / f5 on the screen ?

I need to see more code to help further..

May 9 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.