Jump to content

sending information


Collegeboox

Recommended Posts

Can someone help me send a value in a form to another page...(value=$emailhim)

 

 

This is the sending page

    <?php
  $emailit = $_GET['emailusr'];
echo"
            <table width='602' height='283' border='0'>
               <form action='emailuser.php' method='POST'>
              <tr>
                <td width='210' height='13'>You Are Contacting:</td>
                <td width='382' align='left'><input type='text' name='emailnow' value='$emailit' disabled='disabled'/></td>
                </tr>
              <tr>
                <td width='210' height='14'>Book Title:</td>
                <td width='382' align='left'><input type='text' name='book' maxlength='25'/></td>
                </tr>
              <tr>
                <td width='210' height='14'>ISBN Number: </td>
                <td align='left'><input type='text' name='isbn' maxlength='25'/></td>
              </tr>
              <tr>
                <td width='210' height='15'>My Email:</td>
                <td align='left'><input type='text' name='myemail' maxlength='25'/></td>
              </tr>
              <tr>
                <td height='123' align='left'>Question/Comment:</td>
                <td><textarea name='question' cols='60' rows='5'></textarea></td>
                </tr>
              <tr>
                <td colspan='2' align='center'><input type='submit' name='submit' value='Send' /></td>
                </tr>
                 </form>
            </table>"
		?>

 

 

This is the receiving page



$book = $_POST['book'];
$isbn = $_POST['isbn'];
$myemail = $_POST['myemail'];



if ($_POST['submit'])
{


//existance check
if ($book)
{
	if ($isbn)
	{
		if ($myemail)
		{
			$question = $_POST['question'];
			$username = $_SESSION['username'];
			$emailhim = $_POST['emailnow'];

			//connect to database
			$connect = mysql_connect("db","user","pass") or die("Not connected");
			mysql_select_db("user") or die("could not log in");

			//grab email from database
			$query = "SELECT * FROM desiredusers WHERE username='$emailhim'";
			$result = mysql_query($query);
			while($row = mysql_fetch_array($result))

			//set email to variable name
			$person = $row['email'];

			//set SMTP
			//$server = "smtp.gmail.com";
			//ini_set("SMTP",$server);

			//setup variables
			$to = "[email protected]";
			$subject = "$username has a question";
			$body = "This is an email from $username\n\n
			Their question regarding $book, ISBN#: $isbn\n
			is $question\n\n\n
			This is the email address $username would like you to contact him on: $myemail\n\n\n";
			$headers = "From: $myemail";
			mail($to, $subject, $body, $headers);
			echo "$person";
			echo "$emailhim";

		}
		else 
			die('Please fill in My Email. This will be the email address that the user that you are contacting will email you back on.  (*note if you do not put in your correct email the person that you emailed will have no way of emailing you back)');
	}
	else 
		die('Please fill in ISBN Number.');
}
else 
	die('Please fill in Book Title.');
}

?>

Link to comment
https://forums.phpfreaks.com/topic/229175-sending-information/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.