PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
bla5e wrote:then how would it know who it is accepting?
because if($_GET['yes']) is just checking if the variable is there.. it doesn't lose its value.
the value of $_GET['yes'] is the person's ID (what you were calling $_GET['id'] in your script
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
<?php
if ($_GET['yes'])
{
$con = mysql_connect($server, $user, $password) or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db($database);
echo mysql_error();
$sql = "SELECT * FROM `join` where `id` = '".$_GET['yes']."'";
$result = mysql_query($sql, $con) or die(mysql_error());
echo mysql_error();
while ($data = mysql_fetch_assoc($result)) {
echo ("<br>");
echo ("<form method=\"post\" action=\"yesp2=".$_GET['yes']."");
echo ("<input name=\"email\" type=\"text\" value=\"".$data['email']."\" disabled> ");
echo ("<textarea col=25 rows=20 name=mail>");
echo ("<input type=submit name=submit value=Add>");
echo ("</form");
}
}
?>
That code should work.
It checks to see if $_GET['yes'] is set in the URL string (which it is, it's = to an id number.
Then it performs the query based on the value of $_GET['yes'] which is an id number.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
give me a moment I'm going to clean your code up for you a bit
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
<?
if($_GET['yes'])
{
$con = mysql_connect($server, $user, $password);
mysql_select_db($database, $con);
$result = mysql_query("SELECT * FROM `join` where `id` = '".$_GET['yes']."'");
while($data = mysql_fetch_assoc($result))
{
echo ("<br>");
echo ("<form method=\"post\" action=\"yesp2=".$_GET['yes']."");
echo ("<input name=\"email\" type=\"text\" value=\"".$data['email']."\" disabled> ");
echo ("<textarea col=25 rows=20 name=mail>");
echo ("<input type=submit name=submit value=Add>");
echo ("</form");
}
}
if($_GET['yesp2'])
{
$con = mysql_connect($server, $user, $password);
mysql_select_db($database, $con);
$mail = $_POST['email'];
$AdminMessage = "whateveryouwanthere";
mail($mail, "Team Exile", $AdminMessage, "From: join@teamexileonline.com");
mysql_query("DELETE FROM `join` WHERE `id` = '".$_GET['id']."'");
echo ("<br>Deleted from Requests & Sent mail to user for acceptance.");
}
}
?>
Improvised and cleaned code. Should work.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
if(mail($,$,$,$))
{
// do nothing
} ELSE
{
echo "mail could not be sent";
}
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
is there a value being posted.. like written in the form and then submitted?
Also, where is $_POST['mail'] coming from?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.