Forum Moderators: coopster
Also, I'm concerned about security. Are there security issues to be concerned with when using a script online like this?
WinZip should open it too. Extract the contents to a directory of your choosing, and look it over before you use it. You should find a helpful README or other document if it requires any installation.
[edited by: grandpa at 5:57 pm (utc) on Feb. 18, 2005]
<span class="style8"></span><br>
<br>
<p>Please enter your promo code below: <form name="promo_code_form" action="http://www.example.com/promos_entry.php?osCsid=606f6c2c0d6a3e04d6e75c3db32c3c11" method="GET">
<input type="text" name="promo_code" maxlength=6, size=8>
<INPUT TYPE="submit" NAME="Submit" VALUE="Submit">
<br>
</p>
</div>
</TD>
</TR>
</TABLE></td>
</tr>
Can anyone shed some light on this? I'd really appreciate it. Thanks!
[edited by: jatar_k at 9:51 pm (utc) on Feb. 18, 2005]
[edit reason] generalized [/edit]
<html>
<head>
<title>Login Page</title>
</head>
<body bgcolor="white">
<p><span class="style8"></span><br>
<br>
</p>
<p>Please enter your promo code below: <form name="promo_code_form" action="http://www.example.com" method="GET">
<input type="text" name="promo_code" maxlength=6, size=8>
<INPUT TYPE="submit" NAME="Submit" VALUE="Submit">
<br>
</p>
<?
//if no cookie is set then display the form
if(!isset($_COOKIE["this_cookie"])){
echo '<div align="center"><form action="validate.php" method="post">';
echo 'username : <input type="text" name="username"><br><br>';
echo 'password : <input type="password" name="password"><br><br>';
echo '<input type="submit" value="login"></form></div>';
}else{
echo "You are already logged in. <a href=\"1.php\">Continue</a>";
}
?>
</td>
</tr>
</table>
</body>
</html>
In Dreamweaver, this code looks fine. It shows up as a small form box with a 'Submit' button to the right. The problem now is that I don't know what I need to do at this point so that a user can enter in a code and then be forwarded to another internal page. I have mySQL and PhP. Any help would be GREATLY appreciated!
that line above is wrong, if the user clicks the submit button the information in the form will be sent to the script specified in the action
Set the action to the script
if your script is called process.php and is located in a folder named scripts that is located in the root of your site then your form tag would look like this
<form name="promo_code_form" action="/scripts/process.php" method="GET">
you also want to set the method to post I would think, so
<form name="promo_code_form" action="/scripts/process.php" method="POST">
understand?
That would depend on the amount of information you have to compare it to. If you send out a single promo code for everyone then mysql would be overkill. On the other hand if there are seperate promo codes per email address and there are a bunch of them then mysql will fit the bill nicely.
PHP, yes, you will need some sevrer side scripting to validate and compare the data and then send them off to where they need to go.
So, first things first.
We now have a form, ok, that covers how we get input from users.
Are you going to maintain a user base? Will they have to sign up an account with you?
Do you have promo codes that are tied to existing users, new possible users or both? How many codes are there?
What are all the possible scenarios that can occur once information is entered into the script?
no account? - sign up
bad data? - tell them what is wrong and redisplay the script
invalid promo code? - some kind of error I would think
what else can you think of?
PLEASE...if anyone can help with this I will appreciate it. Thank you...Thank you.
[edited by: ergophobe at 1:48 am (utc) on Feb. 20, 2005]
[edit reason] deleted bump and combined posts [/edit]
form would be something like this
promoform.php
<?php
if (isset($errmsg)) echo '<p>',$errmsg;
?>
<p><form name="mypromo" method="get" action="checkpromo.php">
<input type="text" name="pcode" size="20"> <input type="submit" value="Go">
</form>
now the checkpromo.php needs to be in the same directory, it would look something like this
checkpromo.php
<?php
$errmsg = "";
if (empty($_POST['pcode']) ¦¦!isset($_POST['pcode'])) {
$errmsg = 'Please enter a promotional code';
include 'promoform.php';
} else {
$promocode = trim(strtolower($_POST['pcode']));
switch($promocode) {
case "paper":
$redirectpage = 'paper.php';
break;
case "radio":
$redirectpage = 'radio.php';
break;
case "magazine":
$redirectpage = 'magazine.php';
break;
}
header("Location: $redirectpage");
}
?>
You would just need to put in the real promo codes and the appropriate pages to redirect to.
remember WebmasterWorld breaks pipe ¦ characters these must be replaced with real pipe characters
case "paper": $redirectpage = [widgets.com;...] break;