• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

hidden message [php]


Part of a System
OK here is what i need to do.

I have a form put in more then one location on a site. The info gets emailed to the admin of the site.

I am trying to put a hidden message in the php form that the person inputing the info cant see, but only the admin can see in this email. Any help would be much appreciated. I don't think this is too hard either but kind of rusty on my php.

Each form will have a different message the that can be added by editing the code.
Last edited:

Perris Calderon

Staff member
Political User
can you zip it up in a password protected file?

you can of course use a white font which he'll highligt to see what you want him to see but anyone can access once they know


I may actually be insane.
So you basically have some fields, which are e-mailed to an address, and you wish to add additional text to the submitted information?

Can you post the code you're using to send the e-mail, and also exactly what extra you need sending.


Part of a System
<form action="register.php" method="post" onSubmit="return validate()">
  <p>Username: <span class="style1 style5">*</span><br />
    <input type="text" name="username" size="20">
Password: <span class="style1 style5">*</span><br />
<input type="password" name="password" size="20">
First Name: <span class="style1 style5">*</span><br />
    <input type="text" name="name1" size="20">
    Last Name:<span class="style1 style5"> *</span><br />
    <input type="text" name="name2" size="20">
    E-mail <span class="style1 style5">*</span><br />
    <input type="text" name="email" size="20">
  <br>Phone <span class="style1 style5">*</span><br />
    <input type="number" name="phone" size="20">
    Cell <br />
    <input type="number" name="cell" size="20">
    Street Address<br>
    <input type="text" name="street" size="50">
    <input type="text" name="city" size="20">
    <input type="text" name="state" size="10">
    <input type="number" name="zip" size="15">
    <br />
    <input type="submit" value="Sign Up">


// connect to the mysql server
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());

// select the database
or die ("Could not select database because ".mysql_error());

// check if the username is taken
$check = "select id from $table where username = '".$_POST['username']."';"; 
$qry = mysql_query($check)
or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry); 
if ($num_rows != 0) { 
echo "Sorry, there the username $username is already taken.<br>";
echo "<a href=register1.php>Please try again</a>";
} else {

// insert the data
$insert = mysql_query("insert into $table values ('NULL', '".$_POST['username']."', '".$_POST['password']."', '".$_POST['name1']."', '".$_POST['name2']."', '".$_POST['email']."', '".$_POST['phone']."', '".$_POST['cell']."', '".$_POST['street']."','".$_POST['city']."','".$_POST['state']."', '".$_POST['zip']."')")
or die("Could not insert data because ".mysql_error());

$to      = 'admin@whatever.com';
$subject = 'New Registration';
$message = $_POST['username'] . " " . $_POST['password'] . " " . $_POST['name1'] . " " . $_POST['name2'] . " " . $_POST['email'] . " " . $_POST['phone'] . " " . $_POST['cell'] . " " . $_POST['street'] . " " . $_POST['city'] . " " . $_POST['state'] . " " . $_POST['zip'];
$headers =  'From: admin@whatever.com' . "\r\n" .
                 'Reply-To: admin@whatever.com' . "\r\n" .
                 'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);

// print a success message
echo "Your user account has been created for bla blah.com!<br>"; 
echo "Now you can <a href=login1.php>log in</a>"; 

well ill have this code in diffrent areas of the site

All i want is a message sent to admin of the site. But the message is hidden from the public.

What i want to check is .. what areas bring the person to register for the site.

So if they choice to go to a page and registers ill have a message "resisted through page 1".

i know you can just pass the image name as a variable in the url... but don't want to do it like that... i have some extra stuff in between the image they click and the forms.
Last edited:


Giver of 2 Cents
On top of what LordofLA said you can also take that hidden value and make it an arbitrary value that is per page(if you have any type of ID# on each of your pages you could use that) and then within register.php use some code to look at a table of these id's and match it up with the value that you want returned for that page. This would make it so that each page needs it's own number as well as that number needs entered on each page. This may not work if your pages are dynamically created(i.e. forums where showthread.php is used to show every thread, you would be able to tell by file that called it, but not necessarily what page called it).

This would make it so that if a user looks at the source of the page the only thing they would see is a number that means nothing to them, but when you receive the email it says exactly what you want it to.


Part of a System
Thanks man.. works for me... i knew after you go sleep and you wake up you could figure it out... lol

ok worked perfect thanks for you help lorofla...
Last edited:

Members online

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
What a long strange trip it's been. =)

Forum statistics

Latest member