Form data loss

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nalls
    New Member
    • May 2007
    • 2

    Form data loss

    Hi,

    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?
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    This question is being moved to the PHP forum.

    ADMIN

    Comment

    • Purple
      Recognized Expert Contributor
      • May 2007
      • 404

      #3
      Hi,

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

      Purple

      Comment

      • nalls
        New Member
        • May 2007
        • 2

        #4
        Originally posted by Purple
        Hi,

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

        Purple
        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.p hp">

        <select name = "cardtype">
        <option value ="visa" selected>VISA</option>
        <option value ="mastercard">M astercard</option>
        <option value ="switch">Maest ro</option>
        </select>

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

        </form>


        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_i d']."'";

        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.

        nalls

        Comment

        • Purple
          Recognized Expert Contributor
          • May 2007
          • 404

          #5
          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..

          Purple

          Comment

          Working...