Jump to content

Frank74

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Frank74's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the answer russthebarber. It seems to work with a text form : <input type="text" name="EmitterFirstName" value="<?php echo $EmitterFirstName ?>"/> But it doesn't seem to work with a textarea form : <textarea cols="50" rows="6" name="EmitterMessage" value="<?php echo $EmitterMessage ?>"> The form appears empty even if the string variable $EmitterMessage contains a string. Do you have an idea on how to make this work correctly ? Thanks,
  2. Hi I struggle with something i'm trying to achieve. Maybe this is not the correct approach, i don't know. My goal is to attribute a string of a field of the form to a string variable in order to use this string variable in order to "auto fill" the field of the form previously completed. This is to do what is apparently called a sticky form... First the program attributes the string of a field of the form to a string variable : $EmitterFirstName = $_POST["EmitterFirstName"]; Then in the html form there is a field called "EmitterFirstName", and i want to use the string variable $EmitterFirstName in order to auto fill the field with the string previously typed by the user : <input type="text" name="EmitterFirstName" value="<?php $EmitterFirstName ?>"/> But it doesn't work as expected. Do you have any idea why or maybe an advice on how to code such a thing ? Thanks,
  3. Hi It was indeed the "r" of "$row" which should be Uppercase. I will remind this lesson thanks Thanks for the trick! I have found the solved button on the lower left
  4. Hello, I'm new on this forum and i have not seen the rules to post a code, so i will try to explain my best : I have learned the basics of php during the past few days and i have a php code that is supposed to read parameters in several fields of a Mysql database and to return those parameters as variables in an array. (well that's how i understand it... please correct me if i'm wrong) So here the code and the part that doesn't seem to work properly (colored in red) : //I have changed the following values which are confidential... $DBName = "MyDatabase"; $DBHostName = "MyMysqlServer"; $DBUserName = "MyUsername"; $DBPassword = "MyPassword"; $Table = "MyTable"; //The fields which are in MyTable : // MemberID SMALLINT // MemberName VARCHAR(20) // MemberPassword VARCHAR(20) // MemberEmailAddress VARCHAR(50) // MemberDateTimeInscription VARCHAR(19) //Reading member parameters echo"<br>Reading the parameters of a member."; echo"<br>Defining the parameters of the member to read."; $CurrentName = "Ashley"; $CurrentPassword = "65hl3y"; $CurrentEmailAddress = "Ashley@HisDomain.com"; echo"<br>Trying to start a connection with the Mysql server."; mysql_connect($DBHostName,$DBUserName,$DBPassword) OR DIE(mysql_error()); echo"<br>Selecting the table."; mysql_select_db($DBName) OR DIE(mysql_error()); echo"<br>Searching for the fields corresponding to the CurrentName."; $Query = "SELECT * FROM ".$Table." WHERE MemberName = '".$CurrentName."'"; $Result = mysql_query($Query) or die(mysql_error()); echo"<br>Returning the parameters stored in the fields."; while($Row = mysql_fetch_array($Result,MYSQL_ASSOC)){ /////This is the start of the part that does not seem to work properly. $MemberId = $row["MemberId"]; $MemberName = $row["MemberName"]; $MemberPassword = $row["MemberPassword"]; $MemberEmailAddress = $row["MemberEmailAddress"]; $MemberDateTimeInscription = $row["MemberDateTimeInscription"]; echo"<br>MemberId : ".$MemberId; echo"<br>MemberName : ".$MemberName; echo"<br>MemberPassword : ".$MemberPassword; echo"<br>MemberEmailAddress : ".$MemberEmailAddress; echo"<br>MemberDateTimeInscription : ".$MemberDateTimeInscription; /////This is the end of the part that does not seem to work properly. } echo"<br>Ending the connection with the Mysql server."; mysql_close(); All of echo are here for debug, i'm a beginner with php. This is what the php page shows : Reading the parameters of a member. Defining the parameters of the member to read. Trying to start a connection with the Mysql server. Selecting the table. Searching for the fields corresponding to the CurrentName. Returning the parameters stored in the fields. MemberId : MemberName : MemberPassword : MemberEmailAddress : MemberDateTimeInscription : Ending the connection with the Mysql server. I don't understand why the variables $MemberId, $MemberName, $MemberPassword, $MemberEmailAddress, $MemberDateTimeInscription are empty. Your advices are welcome, Thanks,
×
×
  • 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.