x7 Chat install problems - php

I am using X7 Chat and trying to install it on my localhost. I got an error on the install.php Here's what I have:
I'm not sure how to fix this. Any help please?
And here's the code on the install.php:
<?php if(empty($fail)): ?>
<form id="dbform">
<?php if(!$config): ?>
<h2>Database Connection Details</h2>
<b><label for="host">Database Host</label></b>
<input type="text" name="host" value="localhost" />
<hr />
<b><label for="user">Database Username</label></b>
<input type="text" name="user" value="" />
<hr />
<b><label for="pass">Database Password</label></b>
<input type="password" name="pass" value="" />
<hr />
<b><label for="dbname">Database Name</label></b>
<input type="text" name="dbname" value="" />
<hr />
<b><label for="prefix">Table Prefix</label></b>
<input type="text" name="prefix" value="x7chat_" />
<hr />
<?php endif; ?>
<h2>Admin Account Details</h2>
<b><label for="admin_username">Admin Username</label></b>
<input type="text" name="admin_username" value="" />
<hr />
<b><label for="admin_username">Admin Password</label></b>
<input type="password" name="admin_password" value="" />
<hr />
<b><label for="retype_admin_password">Retype Admin Password</label></b>
<input type="password" name="retype_admin_password" value="" />
<hr />
<b><label for="admin_email">Admin E-Mail</label></b>
<input type="text" name="admin_email" value="" />
<hr />
<h2>Chatroom Details</h2>
<b><label for="title">Chatroom Name</label></b>
<input type="text" name="title" value="" />
<hr />
<input id="continue" type="submit" value="Continue" />
</form>
<?php else: ?>
<p>One or more critical checks failed. Please correct them before installing X7 Chat.</p>
<?php endif; ?>

Related

Second submit button not working in php

I have been having problems with the second button not running like the first button. this is the code I have:
<p>
<form method="POST">
<input placeholder="Username" type="text" name="username"><br /><br />
<input placeholder="password" type="password" name="password"><br /><br />
<input value="Login" type="submit" name="log_In">
</form>
</p>
</div>
<?php
if(isset($_POST['log_In'])) {
#$f_name = $_POST['fname'];
#$s_name = $_POST['sname'];
#$stud_Id = $_POST['studId'];
#$uname = $_POST['uname'];
#$pass = $_POST['pass'];
#$rpass = $_POST['rpass'];
#$email = $_POST['email'];
#$remail = $_POST['remail'];
#var_dump($f_name);
header("Location:home.php");
}
?>
</div>
<div align="right">
<div>
<p>
<h2>Sign Up</h2>
</p>
<p>
<form>
<input placeholder="Forename" type="text" name="fname" id="Forename"><br /><br />
<input placeholder="Surname" type="text" name="sname"><br /><br />
<input placeholder="Student Id" type="text" name="studId"><br /><br />
<input placeholder="Username" type="text" name="uname"><br /><br />
<input placeholder="password" type="password" name="pass" min="6" max="32"><br /><br />
<input placeholder="Re-type password" type="password" name="rpass" min="6" max="32"><br /><br />
<input placeholder="Email" type="" name="email"><br /><br />
<input placeholder="Re-type Email" type="remail" name="remail"><br /><br />
<input value="Sign Up" type="submit" name="sign_Up">
</form>
</p>
</div>
<?php
if(isset($_POST['sign_Up'])) {
header("Location:home.php");
}
?>
</div>
"if(isset($_POST['sign_up'])) {" is not being run and is just refreshing the page and removing all items from the form.
thanks
By default <form> method is GET. So if(isset($_POST['sign_Up'])) won't work. Change it to if(isset($_GET['sign_Up'])).
Or change your second form tag to:
<form method="POST">
Remember not to use header function after generating HTML content, move it to top!
header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.
So it will be better if it is like this:
<?php
if(isset($_POST['log_In']) || isset($_POST['sign_Up'])) {
header("Location:home.php");
}
?>
<form method="POST">
<input placeholder="Username" type="text" name="username">
<br />
<br />
<input placeholder="password" type="password" name="password">
<br />
<br />
<input value="Login" type="submit" name="log_In">
</form>
<div align="right">
<div>
<p>
<h2>Sign Up</h2>
</p>
<p>
<form method="post">
<input placeholder="Forename" type="text" name="fname" id="Forename">
<br />
<br />
<input placeholder="Surname" type="text" name="sname">
<br />
<br />
<input placeholder="Student Id" type="text" name="studId">
<br />
<br />
<input placeholder="Username" type="text" name="uname">
<br />
<br />
<input placeholder="password" type="password" name="pass" min="6" max="32">
<br />
<br />
<input placeholder="Re-type password" type="password" name="rpass" min="6" max="32">
<br />
<br />
<input placeholder="Email" type="" name="email">
<br />
<br />
<input placeholder="Re-type Email" type="remail" name="remail">
<br />
<br />
<input value="Sign Up" type="submit" name="sign_Up">
</form>
</p>
</div>
</div>
You forgot to add method="post"
<form method="post">
<input placeholder="Forename" type="text" name="fname" id="Forename"><br /><br />
<input placeholder="Surname" type="text" name="sname"><br /><br />
<input placeholder="Student Id" type="text" name="studId"><br /><br />
<input placeholder="Username" type="text" name="uname"><br /><br />
<input placeholder="password" type="password" name="pass" min="6" max="32"><br /><br />
<input placeholder="Re-type password" type="password" name="rpass" min="6" max="32"><br /><br />
<input placeholder="Email" type="" name="email"><br /><br />
<input placeholder="Re-type Email" type="remail" name="remail"><br /><br />
<input value="Sign Up" type="submit" name="sign_Up">
</form>
in second form you have not define the method if method is not defined it will accept the GET method default so change your second form tag by
<form action="" method="POST">

dynamically change html based on user input in a drop down with php

I'm totally new to php and I am trying to dynamically change the form displayed when the user makes a choice on a drop down list. I can get the drop down list to show but it does not display anything when I submit.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Forms</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
If (!isset($_GET['userChoice']))
{ //open the if block to write the html to the screen
?>
<h1>Show your html option form</h1>
<form method="GET" action="thirdtry.php" name="userChoice">
<select size="1" id="choice" name="choice">
<option selected="selected">Choose which form you would like</option>
<option value="feedback">Feedback Form </option>
<option value="help">Help Request Form</option>
</select>
<input type="submit">
</form>
<?php
}//close the if block
else{ //show feedback
if($_GET['userChoice']=="feedback")
{
?>
<h1>Show the feedback form</h1>
<form id="fb" name="fb" method="post" >
<fieldset>
<label>First Name:
<br />
<input type="text" name="fName" id="fName" />
</label>
<br />
<label>Last Name:
<br />
<input type="text" name="lName" id="lName" />
</label>
<br />
<label>Street Address:
<br />
<input type="text" name="address" id="address" />
</label>
<br />
<label>City
<br />
<input type="text" name="city" id="city" />
</label>
<br />
<label>State
<br />
<input type="text" name="state" id="state" />
</label>
<br />
<label>Postcode
<br />
<input type="text" name="postcode" id="postcode" />
</label>
<br />
<label>Country
<br />
<input type="text" name="country" id="country" />
</label>
<br />
<label>Email Address:
<br />
<input type="text" name="FromAddress" id="FromAddress" />
</label>
<br />
<label>Your message:
<br />
<textarea name="message" rows="7" cols="30"></textarea> <br />
</label>
<div>How many stars would you give this site? <br />
(We love 5 stars!)<br />
<input type="radio" name="rating" value="1" />1<br />
<input type="radio" name="rating" value="2" />2<br />
<input type="radio" name="rating" value="3" />3<br />
<input type="radio" name="rating" value="4" />4<br />
<input type="radio" name="rating" value="5" />5<br />
</div>
<br />
<input type="submit" />
<input type="reset" />
</fieldset>
</form>
<?php
}
else
{//must be help form
?>
<h1>Show the help form</h1>
<form id="help" method="post" >
<fieldset>
<label>First Name:
<br />
<input type="text" name="fNameHelp" id="fNameHelp" />
</label>
<br />
<label>Last Name:
<br />
<input type="text" name="lNameHelp" id="lNameHelp" />
</label>
<br />
<label>Street Address:
<br />
<input type="text" name="addressHelp" id="addressHelp" />
</label>
<br />
<label>City
<br />
<input type="text" name="cityHelp" id="cityHelp" />
</label>
<br />
<label>State
<br />
<input type="text" name="stateHelp" id="stateHelp" />
</label>
<br />
<label>Postcode
<br />
<input type="text" name="postcodeHelp" id="postcodeHelp" />
</label>
<br />
<label>Country
<br />
<input type="text" name="countryHelp" id="countryHelp" />
</label>
<br />
<label>Email Address:
<br />
<input type="text" name="FromAddress" />
</label>
<br />
<label>Your message:
<br />
<textarea name="messageHelp" rows="7" cols="30"> </textarea> <br />
</label>
<div>How Would you like to be contacted?<br />
(Choose all that apply) <br />
<input type="checkbox" name="ckemail" id="ckemail" value="email" onclick="return validateHelpForm()"/>email<br />
<input type="checkbox" name="cktelephone" id="cktelephone" value="telephone" onclick="return validateHelpForm()"/>telephone<br />
</div>
<br />
<input type="submit" />
<input type="reset" />
</fieldset>
</form>
<?php
}//close the if block
}
?>
</body>
</html>
You're checking for the wrong variable:
If (!isset($_GET['userChoice']))
should be
If (!isset($_GET['choice']))
Also, why are you capitalizing If? (That won't cause an issue - it's just weird ;)
Well first off, do you want the page to refresh, or would you like it to change dynamically without a refresh, using Javascript. From your brief description, I am thinking you want the change to happen without a refresh.
And being a "novice", I would advise you use Jquery as your Framework as opposed to full blown javascript. Here is what I think you're trying to accomplish.
Since PHP is a server-side programming language, you can't dynamically change a webpage without a refresh. Javascript and Jquery are client-side, so many things can happen in your browser without the need or a refresh.
LINK: Here is the example I just created.
////////jquery/javascript///////
$('#changeme').change(function(){
var value = $('#changeme').val();
if(value == 1){
$('#dis1').show();
$('#dis2').hide();
}
else if(value == 2){
$('#dis1').hide();
$('#dis2').show();
}
else{
$('#dis1').hide();
$('#dis2').hide();
}
});
////////HTML///////
<select id="changeme">
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<div style="display:none;" id="dis1">Displaying 1</div>
<div style="display:none;" id="dis2">Displaying 2</div>

PHP MSQL FORM Query Won't Connect

Hey guys I've been trying to do a code where I submit a form from a PHP Order Page so that it can update the MySQL Database with the required information
I've got the Order PHP Code Here:
<form action="http://zim.cs.uow.edu.au/~ga420/order.php" method="post">
<tr>
<th>Shirts</th>
<th>Quantity</th>
</tr>
<tr>
<td>
<br />
<input type="checkbox" name="items" value="SH01" />
<label for="rd1">Obey T-Shirt: $9.99</label>
</div>
<br />
<input type="checkbox" name="items" value="SH02" />
<label for="rd1">Obey Professor: $9.99</label>
</div>
<br />
<input type="checkbox" name="items" value="SH03" />
<label for="rd1">Hustle T-Shirt: $9.99</label>
</div>
<br />
<input type="checkbox" name="items" value="SH04" />
<label for="rd1">Hip-Hop Support: $9.99</label>
</div>
<br />
<input type="checkbox" name="items" value="SH05" />
<label for="rd1">90's Shirt: $9.99</label>
</div>
<br />
<input type="checkbox" name="items" value="SH06" />
<label for="rd1">DOPE Shirt: $9.99</label>
</div>
<br />
<br />
</td>
<td>
<br />
<input type="text" name="qty" size="2" />
<br/>
<input type="text" name="qty" size="2" />
<br/>
<input type="text" name="qty" size="2" />
<br/>
<input type="text" name="qty" size="2" />
<br/>
<input type="text" name="qty" size="2" />
<br/>
<input type="text" name="qty" size="2" />
<br/>
<br />
</td>
</tr>
<tr>
<td>
<br />
<input type="checkbox" name="items[]" value="SO1" />
<label for="rd1">Shoe - Red Lace: $19.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SO2" />
<label for="rd1">Shoe - Red High Top: $19.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SO3" />
<label for="rd1">Shoe - White: $19.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SO4" />
<label for="rd1">Shoe - Black: $19.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SO5" />
<label for="rd1">Shoe - Black High Top: $19.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SO6" />
<label for="rd1">Red Basketball: $19.99</label>
</div>
<br />
<br />
</td>
<td>
<br />
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<br />
</td>
</tr>
<tr>
<td>
<br />
<input type="checkbox" name="items[]" value="SN1" />
<label for="rd1">Snapback Bullets: $29.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SN2" />
<label for="rd1">Snapback: $29.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SN3" />
<label for="rd1">Snapback Bullets: $29.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SN4" />
<label for="rd1">Snapback Bullets: $29.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SN5" />
<label for="rd1">Snapback Bullets: $29.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SN6" />
<label for="rd1">Snapback Bullets: $29.99</label>
</div>
<br />
<br />
</td>
<td>
<br />
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<br />
</td>
</tr>
</tr>
</table>
<br />
<input type="submit" name="submit">
</form>
<?php
if (isset($_POST['submit'])){
$conn = mysql_connect('url','username','password');
if (!$con){
die("Could Not Connect: " . mysql_error());
}
mysql_select_db("db",$conn);
$sql = "INSERT INTO Order_Information(Order_ID,Order_Items,Order_Quantity) VALUES (null,$_POST[items]','$_POST[qty]')";
mysql_query($sql, $con);
mysql_close($con);
}
?>
Obviously my username and password I won't display but when I hit the submit button it says that it cannot connect.
You can try the form yourself on this website:
http://zim.cs.uow.edu.au/~ga420/order.php
How come it is saying that I can't connect when clearly I have been putting the right details in.
Can anyone help? this has been stressing me out :'(
Your help is appreciated greatly!!
You need to serialize all your inputs/quantities if you will have the same name "qty" in all fields. I will update my answer later if you do t get answer about this.
You had also small bugs on your code, notice this:
VALUES (null,'$_POST[items]','$_POST[qty]')"; - you were missing ' before $_POST[items]
$conn = mysql_connect('zim.cs.uow.edu.au','username','password'); - $conn with 2 "n"
So, a corrected version would be:
<?php
if (isset($_POST['submit'])){
$con = mysql_connect('url','username','password');
if (!$con){
die("Could Not Connect: " . mysql_error());
}
mysql_select_db("db",$con);
$sql = "INSERT INTO Order_Information(Order_ID,Order_Items,Order_Quantity) VALUES (null,'$_POST[items]','$_POST[qty]')";
mysql_query($sql, $con);
mysql_close($con);
}
?>
Change to this. You did some mistake on $conn and $con. Then, '$_POST[items]','$_POST[qty]' in query.
if (isset($_POST['submit'])){
$conn = mysql_connect('url','username','password');
if (!$conn){
die("Could Not Connect: " . mysql_error());
}
mysql_select_db("db",$conn);
$sql = "INSERT INTO Order_Information(Order_ID,Order_Items,Order_Quantity) VALUES (null,'$_POST[items]','$_POST[qty]')";
mysql_query($sql, $conn);
mysql_close($conn);
}
Hope this help

Why the mysql code is not submitting values in database

This is the code for the form:
<div id="regform">
<div id="regform-top">
<h2>User Registration</h2>
<p>Please complete this form</p>
</div>
<form id="register-form" name="register-form" action="submit.php" method="post"
class="validation">
<fieldset>
<table>
<tr>
<td>
<div class="fieldgroup">
<label for="user-name">User name*: </label>
<input type="text" id="name" name="name" value="" size="12" class="inpt" /><br
class="clear" />
</div>
<div class="fieldgroup">
<label for="password">Password*: </label>
<input type="password" id="password" name="password" value="" size="12" class="inpt"
/><br class="clear" />
</div>
</td>
<td id="form-note">
<br />
<p><strong>Form Instructions</strong></p>
<p>*Required Field</p>
</td>
</tr>
</table>
<table id="bottom-reg">
<tr>
<td><br />
<div class="fieldgroup">
<label for="firstname">First name*</label>
<input type="text" id="firstname" name="firstname" value="" size="12" class="inpt" />
<br class="clear" />
</div>
<div class="fieldgroup">
<label for="email">Email Address* </label>
<input type="text" id="email" name="email" value="" size="12" class="inpt" /><br
class="clear" />
</div>
<div class="fieldgroup">
<label for="address1">Address 1* </label>
<input type="text" id="address1" name="address1" value="" size="12" class="inpt" />
<br class="clear" />
</div>
<label for="address2">Address 2</label>
<input type="text" id="address2" name="address2" value="" size="12" class="inpt" />
<br class="clear" />
<label for="address2">Address 3</label>
<input type="text" id="address3" name="address3" value="" size="12" class="inpt" />
<br class="clear" />
<div class="fieldgroup">
<label for="country">Country*</label>
<input type="text" id="country" name="country" value="" size="12" class="inpt" /><br
class="clear" />
</div>
</td>
<td><br />
<div class="fieldgroup">
<label for="lastname">Last name*</label>
<input type="text" id="lastname" name="lastname" value="" size="12" class="inpt" />
<br class="clear" />
</div>
<div class="fieldgroup">
<label for="group">Group* </label>
<input type="text" id="name" name="group" value="" size="12" class="inpt" />
<br class="clear" />
</div>
<div class="fieldgroup">
<label for="city">City* </label>
<input type="text" id="city" name="city" value="" size="12" class="inpt" /><br
class="clear" />
</div>
<div class="fieldgroup">
<label for="city">State* </label>
<input type="text" id="state" name="state" value="" size="12" class="inpt" /><br
class="clear" />
</div>
<div class="fieldgroup">
<label for="zip">Zip*</label>
<input type="text" id="zip" name="zip" value="" size="12" class="inpt" /><br
class="clear" />
</div>
</td>
</tr>
</table>
<input type="submit" value="Register" class="submit-btn" />
</fieldset>
</form>
This is the code for submit.php:
<?php
$con = mysql_connect("localhost","viatechp_invacar","storefront72");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("viatechp_invacare", $con);
$sql="INSERT INTO registration(username,password,fname,lname,group,
address1,address2,address3, email,city,state,zip,country )
VALUES
('$_POST[name]','$_POST[password]', '$_POST[firstname]','$_POST[lastname]','
$_POST[group]','$_POST[address1]','$_POST[address2]','$_POST[address3]',
'$_POST[email]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[country]'
)" ;
$query = mysql_query($sql) or die(mysql_error());
$results = mysql_fetch_assoc($query);
if ($results) {
echo 'The query returned ' . $results[ 'registration' ];
} else {
echo 'The query did not return any results';
} ?>
echo $sql;
?>
It is showing an error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group,address1,address2,address3,email,city,state,zip,country ) VALUES ( 'sdfdsf' at line 1
group is an SQL keyword. If this is the name of one of your fields you must enclose it with ` like so:
`group`,`address1`,...
This tells mySQL that it is a field name and not the keyword. It would be good practice to enclose all your fields within ` to prevent any errors like this you may not have noticed.
Spot on by pburgess. GROUP, ORDER are some common field names that we use while programming. Make sure to enclose these using backticks group, always a good practice.
$sql="INSERT INTO registration(username,password,fname,lname,`group`,
address1,address2,address3, email,city,state,zip,country )
VALUES
('$_POST[name]','$_POST[password]', '$_POST[firstname]','$_POST[lastname]','
$_POST[group]','$_POST[address1]','$_POST[address2]','$_POST[address3]',
'$_POST[email]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[country]'
)" ;
Try this
$sql="INSERT INTO registration(`username`,`password`,`fname`,`lname`,`group`,
`address1`,`address2`,`address3`, `email`,`city`,`state`,`zip`,`country` )
VALUES
('$_POST[name]','$_POST[password]', '$_POST[firstname]','$_POST[lastname]',
'$_POST[group]','$_POST[address1]','$_POST[address2]','$_POST[address3]',
'$_POST[email]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[country]')" ;
Because you got some field names which is reserved keywords like for example you have group
Your $_POST values is missing quotes, Try updating them
$sql="INSERT INTO registration
(`username`,`password`,`fname`,`lname`,`group`,`address1`,`address2`,`address3`, `email`,`city`,`state`,`zip`,`country`)
VALUES
('$_POST[\"name\"]','$_POST[\"password\"]',$_POST[\"firstname\"]','$_POST[\"lastname\"]','
$_POST[\"group\"]','$_POST[\"address1\"]','$_POST[\"address2\"]','$_POST[\"address3\"]',
'$_POST[\"email\"]','$_POST[\"city\"]','$_POST[\"state\"]','$_POST[\"zip\"]','$_POST[\"country\"]'
)" ;
Well it is too late but this might help someone. Whenever you want to check why your query doesnt' work.. Always try to echo your query and paste it to the phpmyadmin and it will throw the mySQL error which are more easy to understand that what's the issue in query

Auto populate form and auto submit with URL Parameters

I want to auto populate the below form with URL parameters for example using a URL like this:
example.co.uk/example.php?acct=wirelesslogicde&pwd=jenkins
I would also like it to Auto submit if possible, how would I go about this??
<form action="http://www.twg.com/logincheck.aspx" method="post" name="login" style="margin-bottom: 0;">
<p class="readmore" style="margin-bottom: 0;">
<input name="module" id="module" type="hidden" value="HL"/>
<input name="page" id="page" type="hidden" value="account.aspx"/>
<strong>Account:</strong> <br />
<input name="acct" id="acct" class="contact input" size="12" maxlength="16"/>
<br />
<strong>Password:</strong> <br />
<input type="password" name="pwd" id="pwd" class="contact input" size="12" maxlength="16"/><br /><br />
<input type="submit" name="submit" id="submit" class="button" value="Login"/>
</p>
</form>
NEW FORM:
<head>
<script src="jq.js" type="text/javascript"></script>
</head>
<form action="http://www.zstats.com/logincheck.aspx" method="post" name="login" style="margin-bottom: 0;" id="zstatslogin">
<p class="readmore" style="margin-bottom: 0;">
<input name="module" id="module" type="hidden" value="HL"/>
<input name="page" id="page" type="hidden" value="account.aspx"/>
<strong>Account:</strong> <br />
<input name="acct" id="acct" class="contact input" size="12" maxlength="16" value="<?php echo $_REQUEST['acct']; ?>"/>
<br />
<strong>Password:</strong> <br />
<input type="password" name="pwd" id="pwd" class="contact input" size="12" maxlength="16" value="<?php echo $_REQUEST['pwd']; ?>"/><br /><br />
<input type="submit" name="submit" id="login" class="button" value="Login"/>
</p>
</form>
<script type="text/javascript">
$(document).ready(function() {
$("#login").submit();
});
</script>
<form action="http://www.twg.com/logincheck.aspx" method="post" id="login" name="login" style="margin-bottom: 0;">
<p class="readmore" style="margin-bottom: 0;">
<input name="module" id="module" type="hidden" value="HL"/>
<input name="page" id="page" type="hidden" value="account.aspx"/>
<strong>Account:</strong> <br />
<input name="acct" id="acct" class="contact input" value="<?=$_GET['acct']?>" size="12" maxlength="16"/>
<br />
<strong>Password:</strong> <br />
<input type="password" name="pwd" id="pwd" class="contact input" value="<?=$_GET['pwd']?>" size="12" maxlength="16"/><br /><br />
<input type="submit" name="submit" id="submit" class="button" value="Login"/>
</p>
</form>
Use $_GET to get the values from URL.
For auto submit use, Make sure you have jquery plugin loaded before you use the following script. If you don't have JQuery added get it from JQuery and include the file like any other javascript file in your <head> section of HTML document.
$(document).ready(function() {
$("#login").submit();
});
you could do the autosubmit by using jQuery
$('#some_form_id').onLoad(function(){
$.Post('form_target',{parameters:values});
});
and for the populate you can add
<input name="acct" id="acct" class="contact input" size="12" maxlength="16" value="<?php echo $_REQUEST['acc']; ?>"/>
<input type="password" name="pwd" id="pwd" class="contact input" size="12" maxlength="16" value="<?php echo $_REQUEST['pwd']; ?>"/>
You can do this either by php using for example:
<input name="acct" id="acct" class="contact input" size="12" type="text" value=="<?php echo $_GET['acct'];?>" maxlength="16"/>
or using javascript, which would be a bit more complex, look at the window.location.search to filter down querystrings..
ref: https://developer.mozilla.org/en-US/docs/DOM/window.location

Categories