Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6913483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:13:29+00:00 2026-05-27T09:13:29+00:00

I have a little problem… And I have looked up everywhere how to convert

  • 0

I have a little problem… And I have looked up everywhere how to convert an integer to a string. I found several ways of doing it, but with no success. So right now I have no idea of what the problem might be. I thought that I should ask you if also other people have the same problem as I do.

So what doesn’t work:

$inputname = rand(1, 10000);
    $inputname = "$inputname";
    echo '
        <h3>Translate to English</h3>
        <form name="word" method="post" action="">
            <table border="0">
                <tr><td><label>Swedish:</label></td><td width="200"><input type="text" name="swe" maxlength="100" value="'.$swe.'" readonly /></td></tr>
                <tr><td><label>English:</label></td><td width="200"><input type="text" name="'.$inputname.'" maxlength="100" /></td></tr>
                <tr><td></td><td><input type="submit" name="nextword" value="Next Word" /></td></tr>
            </table>
        </form>
    ';

    if (isset($_POST['nextword'])) {
        $eng = $_POST[$inputname];
        $swe = $_POST['swe'];
        $word = $row['id'];
        if($eng == $row['eng']){
            mysql_query("UPDATE `words` SET `right`='yes' WHERE `id`='$word'");
        }
        else{
            mysql_query("UPDATE `words` SET `right`='no' WHERE `id`='$word'");
        }

I don’t get any errors, but when I check my database it says right=no even if I typed in the correct word. If I change $inputname to a string using $inputname = “string”; it works… So why doesn’t the convert work?

I have tried (string)$var, $var = “$var”, mysql_real_escape_string($var) but with no success…

If you have any ideas of how to solve this please respond.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:13:30+00:00Added an answer on May 27, 2026 at 9:13 am

    Although I haven’t seen the contents of your variables, you have a logical problem: When you open your page the first time, a form is created with a random name for the English input. Then you submit the form and generate a new random name, so these will probably never ever match.

    For example you send in a variable named $_POST['1234'] and then you look for $_POST[$inputname] where $inputname has just been generated randomly.

    Giving a random name to your form variable is a bad idea because it is not that straightforward to receive it after the form has been submitted.

    Apart from that I don’t think your name attribute can start with a number, but that’s not the cause of the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little problem with converting a char string array to an unsigned
I have little problem in my iPhone application code but can not identify. please
Hey most of my issue has been solved but i have little problem This
I have a little problem. I have some text 23%, but I need some
have a little problem here: int IntegerTransformer::transformFrom(std::string string){ stream->clear(); std::cout<<string<<std::endl;; (*stream)<<string; int i; (*stream)>>i;
i have little problem with if { string nom; string ou; nom = 1;
I have a little problem, I wrote a program, server role, doing an infinite
I have a little problem about needing Activity/Application everywhere... More precisely I have classes
I have little problem with a replacement of a little part in an url.
I have little problem in regular expressin creation. Expected input: blahblahblah, blahblahblah, 'blahblahblah', blahblahblah,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.