Jump to content

Recommended Posts

Hiya,

 

I'm working on a translation script, but I'm kinda stuck. The basic idea is to generate a form where the to be translated language is not inserted yet, and after adding a translation, you send the form and it gets updated into the database.

 

The code I currently use to generate the form:

<form action="translationupdate.php" method="post">
<?php

$con = mysql_connect("");  //Connection info hidden, ofc
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("westgadgets", $con);

$result = mysql_query("SELECT * FROM translations
WHERE nl=''"); // Select empty language stuff, nl in this case

while($row = mysql_fetch_array($result))
  {
  echo $row['info']; 
  echo "<input style='display:none;' type='tekst' name ='id' value='" . $row['id'] . "'/>"; // The id is unique, which will be used to update the strings.
  echo "<input type='tekst' name ='en' value='" . $row['en'] . "'/>";
  echo "<input type='tekst' name ='nl' value='" . $row['nl'] . "'/>";
  echo "<br />";
  }
?>
<input type="submit" />
</form>

 

After clicking on the send button, you will be directed to the translationupdate.php page, where the database should be updated, though I have no idea about how to do that with this many variable things.

 

My first question would be, is this the correct method of doing this, or should I be using another method to generate the form and submitting it?

The second one would be how to insert the stuff on the next page, doesn't have to be code as I can code it myself if I just know what to do.

 

Thanks in advance :)

Link to comment
https://forums.phpfreaks.com/topic/238775-mass-update-into-db/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.