0

I want to store these submitted values. Can it be possible without database? using just array. I don't want to store values for a session. Just for long time unless deleted.

<form id="form1" name="form1" method="post" action="">
<form id="form1" name="form1" method="post" action="">

  <p>
    <label for="num1">Some text</label>
    <input type="text" name="num1" id="num1" />
  </p>
  <p>
    <label for="num2">some text</label>
    <input type="text" name="num2" id="num2" />
  </p>
  <p>
    <input type="radio" name="r" id="add" value="add" />
    <label for="add">Addition</label>
  </p>
  <p>
    <input type="radio" name="r" id="sub" value="sub" />
    <label for="sub">Subtraction</label>
  </p>
  <p>
    <input type="radio" name="r" id="mul" value="mul" />
    <label for="mul">Multiplication</label>
  </p>
  <p>
    <input type="radio" name="r" id="div" value="div" />
    <label for="div">Division</label>
  </p>

  <p>
    <label for="select">select</label>
    <select>
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>
  </p>
</form>
5
Contributors
8
Replies
41
Views
4 Years
Discussion Span
Last Post by rubai
1

You can save values in a txt file, JSON format would be a good one. You can use json_encode and json_decode functions. Instead of JSON you can just serialize data into a txt file.

Edited by broj1

1

Other than storing your data in plain text file as broj1 has pointed out, you could also store it in a XML file. You can use cookie, but please DO NOT use this approach if you are storing sensitive information. Also remeber that there is a limitation on how much data you can store in a cookie. I think the limit is around 4096 bytes.

Edited by cossay

1

This type of approach rarely ends well. :(
Well, that's not strictly true, but a DB would be better for storage.

If you have a number of users, each storing a file - it could get very messy.

Edited by diafol

0

Yes broj1 is right,use text file if data is not that hugeand is constant(very rarely updated).But if data is huge and is changing consistenly then it will be better to use datbase only.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.