Well it just looks like a form no special design its just the fields
-John
You are not logged in. Please login or register.
PHP Forums » Posts by jaydesigns
Well it just looks like a form no special design its just the fields
-John
<?php
if($username == "Erick") {
echo "Welcome to the forum Erick";
} else {
echo "This welcome is not for you";
}
?>nice to meet you if you have any questions about php/mysql drop me a PM
Welcome to the forum
-John
If you need help in changing it I can see if I am able to do it email me: JayDesigns@live.com
-John
(I may need access to ftp and possibly PHPMyAdmin)
Welcome to the forum if you have any questions regarding php feel free to Private Message me or Email me: JayDesigns@live.com
-John
i've seen this error pop up time and time again, and the answer is ALWAYS the same. please look here before you post it. the problem is you are outputting to the browser (whitespace included) before sending a header. this is unallowed. remove output prior to the header, or use OUTPUT BUFFERING.
NEW EDIT TO THIS TOPIC:
what usually results in these errors is poor script design. when one processes a form, they should do it BEFORE OUTPUTTING ANYTHING TO THE BROWSER. there is NO reason that the process cannot be operated in the header of the document, before any HTML is output.
let's take a common example. the programmer wants a login form which checks the username and password against the database. if they don't match, then don't set a cookie remembering them and tell them it failed. if they do match, set the cookie and send them to a member page. many will do:
[HTML starting the page and layout]
[PHP processing the form]
[form code]
because they can simply echo any errors straight from PHP right above that form. they can also send a success message, set the cookie, and header() them off on their merry way without seeing the form again. it's a logical place to put this code. think again. you'll (perhaps not so) obviously get header errors when you go to use setcookie() and header(). if the login fails, it's dandy, but if you have a successful login the user gets nowhere.
answer: put the processing in the header, and store the results in variables. perhaps a $result variable that is 1 if successful, 0 if failed. then $output that contains either a success message or customized error messages. the new code would look like:
[PHP processing the form (if it was sent) and storing the results]
[HTML starting the page and layout]
[PHP echoing the results]
[form code if failed - exit(); if successful]
this will solve your header errors and will make for much more maintainable and readable code. if you want to redirect them elegantly (with a success message), use a <meta> refresh redirect. header() should only be used in instances where instant redirection is desired.
Hello,
I think you should post instead of the date the post was made to the name of thread that was posted in.
Just an idea if you need help doing this just let me know via PM or right here.
-John
Hello,
I am from Massachusetts, United States.
Where are you from?
Hello,
In this tutorial you will learn how to make a simple contact form:
<?php
if(isset($_POST['submit'])) {
$to = "you@you.com";
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$option = $_POST['radio'];
$dropdown = $_POST['drop_down'];
foreach($_POST['check'] as $value) {
$check_msg .= "Checked: $value\n";
}
$body = "From: $name_field\n E-Mail: $email_field\n $check_msg Option: $option\n Drop-Down: $dropdown\n Message:\n $message\n";
echo "Data has been submitted to $to!";
mail($to, $subject, $body);
} else {
?>
<form method="POST" action="mailer.php">
Name:
<input type="text" name="name" size="19"><br>
<br>
E-Mail:
<input type="text" name="email" size="19"><br>
<br>
<input type="checkbox" name="check[]" value="blue_color"> Blue<br>
<input type="checkbox" name="check[]" value="green_color"> Green<br>
<input type="checkbox" name="check[]" value="orange_color"> Orange<br>
<br>
<input type="radio" value="yes" name="radio"> YES<br>
<input type="radio" value="no" name="radio"> NO
<br>
<br>
<select size="1" name="drop_down">
<option>php</option>
<option>xml</option>
<option>asp</option>
<option>jsp</option>
</select><br>
<br>
Message:<br>
<textarea rows="9" name="message" cols="30"></textarea><br>
<br>
<input type="submit" value="Submit" name="submit">
</form>
<?php
}
?>Hello,
In this tutorial you will learn how to make a simple PHP calculator
<?php
if($submit)
{
if($operator == '*')
{
echo $numa * $numb;
} elseif($operator == '/')
{
echo $numa / $numb;
} elseif($operator == '+')
{
echo $numa + $numb;
} elseif($operator == '-')
{
echo $numa - $numb;
}
} else { ?>
<form method="POST" action="<?php $_SERVER['PHP_SELF']; ?>">
<input type="text" name="numa" size="10">
<select name="operator">
<option value="+">Add</option>
<option value="-">Subtract</option>
<option value="*">Multiply</option>
<option value="/">Divide</option>
</select>
<input type="text" name="numb" size="10">
<input type="submit" value="Calculate" name="submit">
</form>
<?php } ?>
Read more: http://www.webdesign.org/web/web-programming/php/php-calculator.10025.html#ixzz0TUVwwSdsHello,
Here is a tutorial on how to make a simple captcha script
<?php
session_start();
$strlength = rand(4,7);
for($i=1;$i<=$strlength;$i++)
{
$textornumber = rand(1,3);
if($textornumber == 1)
{
$captchastr .= chr(rand(49,57));
}
if($textornumber == 2)
{
$captchastr .= chr(rand(65,78));
}
if($textornumber == 3)
{
$captchastr .= chr(rand(80,90));
}
}
$randcolR = rand(100,230);
$randcolG = rand(100,230);
$randcolB = rand(100,230);
/initialize image $captcha is handle dimensions 200,50
$captcha = imageCreate(200,50);
$backcolor = imageColorAllocate($captcha, $randcolR, $randcolG, $randcolB);
$txtcolor = imageColorAllocate($captcha, ($randcolR - 20), ($randcolG - 20), ($randcolB - 20));
for($i=1;$i<=$strlength;$i++)
{
$clockorcounter = rand(1,2);
if ($clockorcounter == 1)
{
$rotangle = rand(0,45);
}
if ($clockorcounter == 2)
{
$rotangle = rand(315,360);
}
//$i*25 spaces the characters 25 pixels apart
imagettftext($captcha,rand(14,20),$rotangle,($i*25),30,$txtcolor,"/arial.ttf",substr($captchastr,($i-1),1));
}
for($i=1; $i<=4;$i++)
{
imageellipse($captcha,rand(1,200),rand(1,50),rand(50,100),rand(12,25),$txtcolor);
}
for($i=1; $i<=4;$i++)
{
imageellipse($captcha,rand(1,200),rand(1,50),rand(50,100),rand(12,25),$backcolor);
}
//Send the headers (at last possible time)
header('Content-type: image/png');
//Output the image as a PNG
imagePNG($captcha);
//Delete the image from memory
imageDestroy($captcha);
$_SESSION[captchastr] = $captchastr;
?>if you have any other questions please feel free to post 'em here or in a new thread.
-John
Hello,
I will be available to help and setup/install your scripts if you are having trouble with it. This does not mean I will be custom coding your scripts or altering it unless it is a modification for a script you are trying to install.
-John
It is very simple to connect to a mysql database:
just use this simple code:
<?php
mysql_connect("localhost", "username", "password") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("database") or die(mysql_error());
echo "Connected to Database";
?>Hello,
Here is a tutorial on how to find out instantly when someone makes a purchase from your paypal
in this tutorial there will be 2 files
-payment.php -Gets Info
-orderconfirmation.php -Processes Info
================================
payment.php:
<?php
/*
Free Payment Proccessing Script
Script Designed by JayDesigns
JayDesigns@live.com
*/
?>
<html>
<head>
<title> Order Page </title>
<style type="text/css">
div {
background-color:#b0c4de;
margin-top:100px;
margin-bottom:100px;
margin-right:400px;
margin-left:400px;
border-style:solid;
border-color:#98bf21;
}
</style>
</head>
<body bgcolor="e5e4e4">
<center>
<div>
<h1> Order Page </h1>
<?php
if(isset($_GET['submit'])){
$email = $_GET['email'];
$name = $_GET['name'];
?>
<div>
<td width="33%" style="border-style: none; border-width: medium;">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" value="_xclick" name="cmd">
<input type="hidden" value="JneroCorp12345@gmail.com" name="business">
<input type="hidden" value="Item Name" name="item_name">
<table>
<tbody><tr><td>
<p style="margin-top: 0pt; margin-bottom: 0pt;"><font size="3">Select</font></p></td></tr><tr><td>
<p style="margin-top: 0pt; margin-bottom: 0pt;"> </p>
<p style="margin-top: 0pt; margin-bottom: 0pt;"><select name="amount">
<option value="10.00"> $10.00
</option><option value="20.00"> $20.00
</option><option value="30.00"> $30.00
</option></select> </p></td></tr>
</tbody></table>
<input type="hidden" value='./orderconfirmation.php?email=<?php echo "$email"; ?>&name=<?php echo "$name"; ?>' name="return">
<input type="hidden" value="1" name="no_note">
<input type="hidden" value="USD" name="currency_code"/>
<input type="image" height="47" border="0" width="122" alt="" name="submit" src="http://www.call52.com/btn_buynowCC_LG.gif"/>
<img height="1" border="0" width="1" src="pixel.gif" alt=""/>
</form>
</td>
</div>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
Name: <input type="text" name="name"><br>
Email: <input type="text" name="email"><br>
<input type="submit" name="submit" value="submit">
</form><br><br>
<font size="1">Payment Script Developed by JayDesigns@live.com</font>
</div>
<?php
}
?>
</center>
</body>
</html>
?>
</center>and this would be the code for the orderconfirmation.php
<?php
/*
Free Payment Proccessing Script
Script Designed by JayDesigns
JayDesigns@live.com
*/
$myemail = "youremail@domain.com"; //Your Email Address
if(isset($_GET['email'])){
$name = $_GET['name'];
$email = $_GET['email'];
$to = "$myemail";
$subject = 'Paypal Purchase Made';
$message = "A Paypal Purchase has been made bu $name , \r\n \r\n Here is the Information: \r\n Email: $email";
$headers = "From: $myemail" . '\r\n' . "Reply-To: $myemail" . '\r\n' . "X-Mailer: PHP/" . phpversion();
mail($to, $subject, $message, $headers);
} else {
?>
<font color="red"> Invalid Parameters </font>
<?php
}
?>Hello,
I think a new theme is to be put into place so that this forum looks more "Proffesional" I dont know but you should find something or have a theme custom made ![]()
-John
P.S also you should change the max time between posting your next post to 30 seconds instead of 60
Hello,
here is a tutorial on how to make a password protected page
demo: http://joeyelectric.com/demos/password.php
=========================================
In this tutorial we will use the crypt(); command to encrypt our passwords
files?
-password.php
==========================================
First open a new document in a text editor I use Notepad ++ (Free Opensource text editor)
Now Put this code in their
<html>
<head>
<title> Password Test </title>
</head>
<body>
<center>
<h1> Password Test </h1>
</body>
</html>Next we will create the form:
you will notice that for the action="" we have used "<?php echo $_SERVER['PHP_SELF']; ?>" this will make it so that all the form is processed in password.php
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="password">
<input type="submit" name="enter" value="submit">
</form>now we will add the functions to the script
<?php
if(isset($_GET['enter'])){
$user_input = $_POST['password']; //This is the password the user typed
$user_input_crypt = crypt($user_input); //This will encrypt the password
$password = crypt('mypassword'); //This is the actual password before it is encrypted about to be encrypted
if (crypt($user_input, $password) == $password) { // This determines whether the passwords match or not
echo "<font color='green'>Correct Password!</font>"; // if the password is correct this is displayed
} else {
echo "<font color='red'>Incorrect Password!</font><br><br>";
echo "The Password you typed came back as: $user_input_crypt <br> it should have been: $password"; // if not this is displayed
}
} else {
$password = crypt('sc55207');
?>Now here is the code all put together:
<html>
<head>
<title> Password Test </title>
</head>
<body>
<center>
<h1> Password Test </h1>
<?php
if(isset($_GET['enter'])){
$user_input = $_POST['password'];
$user_input_crypt = crypt($user_input);
$password = crypt('sc55207');
if (crypt($user_input, $password) == $password) {
echo "<font color='green'>Correct Password!</font>";
} else {
echo "<font color='red'>Incorrect Password!</font><br><br>";
echo "The Password you typed came back as: $user_input_crypt <br> it should have been: $password";
}
} else {
$password = crypt('sc55207');
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="text" name="password">
<input type="submit" name="enter" value="submit">
</form>
</body>
</html>Great site name hope this site gets more popular I will be here mainly to help others with their php work ![]()
I have 3 dogs and 6 cats
Kipper chihuahua (dog) Age 7 Male
Mocha chihuaha (dog) Age 4 Male
Diesel French Mastif (dog) Age 2 Male
Blackjack mixed breed (cat) Age 21 Female
Whiskers mixed breed (cat) Age 12 Female
Chance unkown (cat) Age Unkown Female
Angel mixed breed (cat) Age 5 Male
Hershey mixed breed (cat) Age 16 Female
Nermal Persian (cat) Age 4 Male
-John
PHP Forums » Posts by jaydesigns
Powered by PunBB, supported by Informer Technologies, Inc.