Hi to all, php n00b here :-)
I have a simple problem and would like to ask for some help...
What I want to do is this: when our affiliate submits his aff ID into the form, a php script should post that ID from DB, but load it into an iFrame. Here is form an iframe code:
<form action="get_Code.php" method="post">
Your affiliate ID: <input type="text" name="affID" />
<input type="submit" />
</form>
<div style="position:absolute;left:0px;top:0px;visibility:hidden;" id="datadiv">
<iframe src="about:blank" height="0" width="0" name="gatewayCode"></iframe>
</div>
And here is messed up php code so far; pls help a little!
Thanks!
Boštjan
$conn = mysql_connect("localhost", "mysql_user", "mysql_password");
if (!$conn) {
echo "Unable to connect to DB: " . mysql_error();
exit;
}
if (!mysql_select_db("mydbname")) {
echo "Unable to select mydbname: " . mysql_error();
exit;
}
$id = $_GET['id'];
$sql = "SELECT * FROM users WHERE id = $id";
$result = mysql_query($sql);
if (!$result) {
echo "Could not successfully run query ($sql) from DB: " . mysql_error();
exit;
}
if (mysql_num_rows($result) == 0) {
echo "No rows found, nothing to print so am exiting";
exit;
}
while ($row = mysql_fetch_assoc($result)) {
echo $row["id"];