Need help with a PHP code. $_POST[ ]?
|
12-02-2013, 11:22 AM
Post: #1
|
|||
|
|||
Need help with a PHP code. $_POST[ ]?
I am writing a small simple database for my karate dojo. I typed up the database in MySQL code and im trying to bring it up through XAMPP. I have a connection file that connects my php files to the database, so i dont have to do that in each file. I am having trouble with the $_POST[]. Right now i have the following at the moment:
<?php include("SMSdatabase_connect.php"); echo "What is the students Emergency Contact? " . " <br/>" ; $result = mysql_query(" SELECT basicInfo.FName, basicInfo.LName, emergency.EmerFN, emergency.EmerLN, emergency.Relation, emergency.EmerPhone From basicInfo, emergency WHERE basicInfo.StId = emergency.StId AND basicInfo.FName = '$_POST[FName]'"); echo "<br>"; echo "<table border='1'> <tr> <th>FName</th> <th>LName</th> <th>EmerFN</th> <th>EmerLN</th> <th>Relation</th> <th>EmerPhone</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['FName'] . "</td>"; echo "<td>" . $row['LName'] . "</td>"; echo "<td>" . $row['EmerFN'] . "</td>"; echo "<td>" . $row['EmerLN'] . "</td>"; echo "<td>" . $row['Relation'] . "</td>"; echo "<td>" . $row['EmerPhone'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($link); ?> After I save that in a .php and .html, I get the following as print out on the page: " ; $result = mysql_query(" SELECT basicInfo.FName, basicInfo.LName, emergency.EmerFN, emergency.EmerLN, emergency.Relation, emergency.EmerPhone From basicInfo, emergency WHERE basicInfo.StId = emergency.StId AND basicInfo.FName = 'Fname15'"); echo " "; echo ""; while($row = mysql_fetch_array($result)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo " **the table is shown here but with no info because I can't get the $_POST to work** $row['Relation'] . "" . $row['EmerPhone'] . " "; mysql_close($link); ?> Can anyone help me out? This has been bugging me for a few days now and I can figure it out. Thanks!! Jeff, that is the thing. It is not giving me an error or line number. It isnt telling me that anything is messed up. When i use the surf to my XAMPP (Apache) server and click on the file name, in this case the 'emergency.html' the following appears: " ; $result = mysql_query(" SELECT basicInfo.FName, basicInfo.LName, emergency.EmerFN, emergency.EmerLN, emergency.Relation, emergency.EmerPhone From basicInfo, emergency WHERE basicInfo.StId = emergency.StId AND basicInfo.FName = 'Fname15'"); echo " "; echo ""; while($row = mysql_fetch_array($result)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo " **the table is shown here but with no info because I can't get the $_POST to work** $row['Relation'] . " " . $row['EmerPhone'] . " "; mysql_close($link); ? This is why i am confus Ads |
|||
12-02-2013, 11:38 AM
Post: #2
|
|||
|
|||
What error are you getting exactly? I can't tell what your problem is because you didn't list any error messages, what line number is causing the error, etc. You need to add some details to your question if you want an answer.
Ads |
|||
12-02-2013, 11:40 AM
Post: #3
|
|||
|
|||
You have not clearly mentioned how the form containing text box fname is submitted. Check whether it is "set" on "unset"
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)