tryphy 0 Junior Poster in Training

HI saiprem...

Thanks for ur reply...
I worked with the code, as you said...

$values['creator_address'] = '$ss_address';
$values['tm_name'] = '$ss_name';

 foreach($values as $keys=>$val)
{
    unset($_SESSION[$keys]);
    $_SESSION[$keys] = $val;
}

notsure, if it is correct or wrong...
It doesnt work... I m totally lost....
Could you please.. help me with the codes... can u add the codes, in the pg1.php and pg2.php.... of my first posting.. and let me know...Pls help me with it.. Thanks...
and not sure how to use the session...while passing to the next page...

tryphy 0 Junior Poster in Training

Sorry I edited it again and removed that in my post check it again...:)

HI sai,.

Where exactly the code has as be copied..


What does the variable: values, keys, val ...define... ?
Guide me with this.. as i m not sure how to do it ...

tryphy 0 Junior Poster in Training

It is so simple, just add this loop at the end of your verifyform function

foreach($values as $keys=>$val)
{
    unset($_SESSION[$keys]);
    $_SESSION[$keys] = $val;
}

 return count($errors);

Thanks, saiprem....
sry wat do u mean by the verify form function
:(

tryphy 0 Junior Poster in Training

Either that or place said variables into a session for retrieval

Yes, i know its like somewhat using session.. for retrieval..
Could u pls, guide mw with the code..
Thanks for your help..
I gotta finish this by today..
Do help me kindly.. thanks..
:)

tryphy 0 Junior Poster in Training

Because you are always retrieving the data from the database and showing in that field, If you want to populate your data, every time you need to update or save your data in your DB.

Hi saiprem,,

Thanks for the reply...
Can u help me with the code, how to do it..?

tryphy 0 Junior Poster in Training

How do i send a form data in html format in a php email.. ?

Use of html tags in $message = ' ';

Any sample example.. cos i tried many.. and coudnt able to work...

ur help is much appreciated...
thanks again

tryphy..

tryphy 0 Junior Poster in Training

Hi guys,

Could anyone help me out with this...

I have a multi form, which the user enter in the data and submits the data.. It also have a save button in it.. so user can save and then come back,.. then can save again, or submit..

I saved the data to a table in db.. when the user comes again...the data has to be reloaded in the textfield, that is retrieve...

so i used...

<input type="text" name="aa" value="<?php echo "$ss_address"; ?>" />

which is retrieve the data from database..
since it is a multi form,
when i change the data in the text field, and go to next page and come back.. the data doesnt change... its still the old data which is retrieved from the db..

I know., it something with passing session..

Can someone help me out..
I have posted the codes below:

pg1.php

<?php
session_start();
?>
<?php 
include "base.php"; 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
$txt_name = $_SESSION['txt_name'];
echo "$txt_name";
$query  = "SELECT p_id,id,company_country,Project_title,total_grant,partner_company,end_date,c_name FROM create_project where c_name ='$txt_name'";
$result = mysql_query($query);
if($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
            $p_id = $row['p_id'];
			$id = $row['id'];
			echo "Project ID: $p_id";
			echo "<br>";
			echo "Company ID: $id";
			echo "<br>";  
}
?>
<?php
$saved_query = "SELECT * FROM creator_save WHERE p_id ='$p_id' AND id = '$id' AND status = 'saved'";
$saved_result …
tryphy 0 Junior Poster in Training

Set the js function to your submit button as opposed to your form action. Then you need to check the client-side validation result. If all ok do a

document.form1.submit();

'
Wr do i add the code ?

tryphy 0 Junior Poster in Training

I have a multi form,
In a form, i have the <back and Next> button.
So i used the form action in these to button, I also have a validation which i did using javascript ,

<head>
<script type="text/javascript">
function validate_name(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);return false}
else {return true}
}
}

function validate_form(thisform)
{
with (thisform)
{
if (validate_name(txt_name,"Please enter the Name!")==false)
  {
  txt_name.focus();return false
  } 
}
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="" onsubmit="return validate_form(this);">
</form>
</body>

so , added the javascript function in form.. The validation works good..but after that it doesnt bring me to the next page..


This is the code that i added in next button,

<input type="submit" name="button" id="button" value="Next &gt;&gt;" onClick="form.action='creport3.php';" />

But if i want to add the validation also, where do i add it.. it needs to be added in the next button onclick event, but how will be the code...
Any help pls..

tryphy 0 Junior Poster in Training

hey thnks for the code,
It helped me...
Got things to work..
:)
Thanks again

tryphy 0 Junior Poster in Training

PHP code won't actually call the function for you. It just prints whatever is in the echo statement to the page, it doesn't trigger any function names it prints.

If you don't mind my asking, why disable the textboxes? Instead, you can have PHP print them out, or not print them out:

<?php 
$cc = $row['company_country'];
$s = "SG";
if ($cc != $s) { ?>
<input type="text" id="tmphone2" name="tmphone2" size="10" maxlength="10" />
<input type="text" id="pmphone2" name="pmphone2" size="10" maxlength="10" />
<?php
}
?>

Hey thanks for the code,
Actually i m using for Phone numbers,
But my design is different...i have the two text fields, in two different places...
HOw do i then write the code...

tryphy 0 Junior Poster in Training

Hi,

I have a javascript function to disable and enable a textbox.

<SCRIPT LANGUAGE="JavaScript">
function enable()
{
document.form1.tmphone2.disabled=false;
document.form1.pmphone2.disabled=false;

}
function disable()
{
document.form1.tmphone2.disabled=true;
document.form1.pmphone2.disabled=true;
}
</SCRIPT>

I need to call the function in a php code, on condition
Heres my code:

<?php 
$cc = $row['company_country'];
$s = "SG";
if ($cc == $s)
	{
echo "<SCRIPT LANGUAGE='javascript'>disable()</SCRIPT>";
}
else
{
//echo "test ";
echo "<SCRIPT LANGUAGE='javascript'>enable()</SCRIPT>";
}
?>

The above php code doesnt work..
But if i used the same javascript disable() function in an onclick event it works.
Why does the code doesnt work ?
where have i gone wrong.?
:(

tryphy 0 Junior Poster in Training

Got it working :

<input type="radio" name="yesrno" id="radio" value="yes"<?php if($_SESSION['rad_radio']=='yes') echo 'checked="checked"'; ?> />


 <input type="radio" name="yesrno" id="radio" value="no" <?php if($_SESSION['rad_radio']=='no') echo 'checked="checked"'; ?> />
tryphy 0 Junior Poster in Training

How to remember a radio button selection in the multi form ..?

<input type="radio" name="yesrno" id="radio" value="yes"<?php if($_SESSION['rad_radio']) echo 'checked="checked"'; ?> />

<input type="radio" name="yesrno" id="radio" value="no" <?php if($_SESSION['rad_radio']) echo 'checked="checked"'; ?> />

It keeps on appear the selection "NO".

Any Help ?
Thanks

tryphy 0 Junior Poster in Training

Got it working..
I changed it to..

if (!isset($_SESSION['phone']) || isset($_POST['txt_phone'])) {
	$_SESSION['phone'] = $_POST['txt_phone'];
}
tryphy 0 Junior Poster in Training

Hi bhanuprakash,

Your code works, but if lets say that I go from
One ----- > two ---- > threee... the text all remain there..
and when i go back to page one <---- and edit the name, that i change the name...then i go to page 2(two) and come back<--- to page one, the new text name that i have entered is not shown,
It takes the old text thats been typed b4...
How can it be solved..?
:(

tryphy 0 Junior Poster in Training

Hi bhanuprakash,
Thanks for the help

Ur Code helps me...

Thanks a lot... :)

tryphy 0 Junior Poster in Training

Where you use $_SESSION[blah]=$_POST you should place that in an if statement like the following.

if (isset($_POST) && !empty($_POST)) {
$_SESSION['blah']=$_POST['blah'];
$_SESSION['asdf']=$_POST['asdf'];
}

This way if $_POST is empty, session will not be assigned an empty value.

Hey cwarn, thanks for ur help,

But its still the same....
:(

y ?

tryphy 0 Junior Poster in Training

I have four forms

one --> two ---> threee -----> four

I used session here...
when i go from one --- > the code works good
then when i go from two ----> three also works good..
but in the third page, when i click back <----- and then from page 2 when i click back <----- i cant see the data that i typed in form 1...

Can someone help me where i have gone wrong ?

My codes are below:

one.php

<?php
session_start();
$_SESSION['name'];
$_SESSION['phone'] = $_POST['txt_phone'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>one</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="two.php" >
  <label>
  Name:
  <input type="text" name="txt_name" id="txt_name" value="<?php echo $_SESSION['name']; ?>" />
  </label>
  <p>
    <label>
    <input type="submit" name="submit" id="button" value="Next" />
    </label>
  </p>
</form>
<p>&nbsp;</p>
</body>
</html>

two.php

<?php
session_start();
$_SESSION['name'] = $_POST['txt_name']; 
$_SESSION['email'] = $_POST['txt_email'];
echo $_SESSION['name'];
echo "<br>";
echo $_SESSION['email']; 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Two</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
  <label>Phone Number:
  <input type="text" name="txt_phone" id="txt_phone" value="<?php echo $_SESSION['phone']; ?>" />
  </label>
  <p>
    <label></label>
  </p>
  <table width="360" border="0">
    <tr>
      <th scope="row"><input type="submit" name="button2" id="button2" value="Back" onclick="form1.action='one.php';" /></th>
      <td><input type="submit" name="button" id="button" value="Next" onclick="form1.action='three.php';" /></td>
    </tr>
  </table>
  </form>
</body>
</html>

three.php

<?php
session_start();
$_SESSION['name'];
$_SESSION['phone'] = $_POST['txt_phone'];
$_SESSION['com'] = $_POST['txt_com'];
echo $_SESSION['name'];
echo "<br>"; …
tryphy 0 Junior Poster in Training

Sorry i missed the below 2 lines to be inclued in form1.php in the above post.

$email = $_POST;
$username = $_POST;

hi, Bhanuprakash;

Thanks for ur reply...Actually, i aint using one field per page..
Its just a sample..Actually each Form has more than 9 fields..
Thats y, i used multiform...
and i am not sure how to use the back button/..Can u explain me more abt the code..

Here are my codes:
which works good in the Forward way.

one.php

<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>one</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="two.php">
  <label>
  Name:
  <input type="text" name="txt_name" id="txt_name" />
  </label>
  <p>
    <label>
    <input type="submit" name="submit" id="button" value="Next" />
    </label>
  </p>
</form>
<p>&nbsp;</p>
</body>
</html>

two.php

<?php
session_start();
$_SESSION['name'] = $_POST['txt_name']; 
echo $_SESSION['name']; 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Two</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
  <label>Phone Number:
  <input type="text" name="txt_phone" id="txt_phone" />
  </label>
  <p>
    <label></label>
  </p>
  <table width="360" border="0">
    <tr>
      <th scope="row"><input type="submit" name="button2" id="button2" value="Back" onclick="form1.action='one.php';" /></th>
      <td><input type="submit" name="button" id="button" value="Submit" onclick="form1.action='result.php';" /></td>
    </tr>
  </table>
  </form>
</body>
</html>

result.php

<?php
session_start();
?>
<?php 
$db = "tryphy";
$link = mysql_connect("localhost","root","");
if (!$link)
{
die("Couldn't connect to MySQL");
}

mysql_select_db("tryphy",$link)
or die("Couldn't open $db: ".mysql_error($link));
$_SESSION['phone'] = $_POST['txt_phone'];
$n = $_SESSION['name'];
$p = $_SESSION['phone']; 
?>
<!DOCTYPE …
tryphy 0 Junior Poster in Training

Could you not use a $_SESSION and pass a session to each page? once the form is complete you can kill the session.

Might not be the best solution

Hope it helps...

Yah, i used session to pass the values from one page to another,
But when, click back button, how does the value appear in the textbox..
I am so confused..

Can explain me ?

tryphy 0 Junior Poster in Training

Hi friends,
I have a multi form(actually is one whole form, but split into multiple forms).
From the image seen
When i typed the name data in Form 1, and click the next button and go to Form 2...
In Form 2 when i typed the Email data..and then i realize, the name data that i entered in Form 1, is wrong, so, I click the <Back button in Form 2..and i go in but i dont see the data that i typed in, then when i click the next button in Form1 to go to Form 2> I cant see the data thats been typed in Form 2 also..
I can insert the data into table, If i just go forward.... >>
ie:
Form1 -> Form 2 -> Result.
How can this problem be solved?
I want to see the data's that been typed in, either if they go <back or Forward>..
Can some1 guide me with this..


Thanks,
Tryphy

tryphy 0 Junior Poster in Training

woooh... hooo. ;)

I managed to solve the problem, with the help of Banderson and vsmash,..

Thanks a lot guys,,
:)

tryphy 0 Junior Poster in Training

Thanks for ur help..

:)

I have sent a pm to u.

tryphy 0 Junior Poster in Training

Hey, thanks a lot for the help..
No i didnt think anything..
I will do some changes..and let u know..
I will send the code to you, can u check and correct it for me..

Thanks for ur help again

tryphy 0 Junior Poster in Training

In line 17 i already have the

echo "$m_id" ;

It doesnt print any thing

tryphy 0 Junior Poster in Training

Where id is the company id, from the company table..

tryphy 0 Junior Poster in Training

What is the duplicate error? Are you auto incrementing as previously stated?

Echo your error to screen with :

echo mysql_error ();

This is my code:

<?php 
$sql = mysql_query("SELECT id from create_project");
$result = mysql_fetch_assoc($sql);
$s_id=$result['id'];
echo "$s_id" ;
echo "<br>";
$num = 01;

if($companyname == $s_id)
{
$max_sql = mysql_query("SELECT MAX(p_id) as proj_id FROM create_project where id = '$companyname'",$link);
$max_result = mysql_fetch_assoc($max_sql);
$max_id = $max_result['proj_id'];
$m_id = $max_id + 01;
echo "$max_id" ;
echo "<br>";
echo "$m_id" ;
echo "<br>";
$query = "INSERT INTO create_project(p_id, company_name, id, Project_title, total_grant, partner_company, end_date, c_name, c_pass, a_name, a_pass)"."VALUES('$m_id','$companyname','$companyname','$title','$grant','$pcompany','$date','$cname','$cpass','$aname','$apass')"."WHERE id = '$companyname'";
mysql_query($query,$link)
					or die("Couldn't add data to add to \"Create Project\" table: 
".mysql_error($link));
}
else 
{
//echo "Adding new record";
$query1 = "INSERT INTO create_project(p_id, company_name, id, Project_title, total_grant, partner_company, end_date, c_name, c_pass, a_name, a_pass)"."VALUES('$num','$companyname','$companyname','$title','$grant','$pcompany','$date','$cname','$cpass','$aname','$apass')";

mysql_query($query1,$link)
					or die("Couldn't add data to add to \"Create Project\" table: 
".mysql_error($link));

}

and my create table is
create table create_project
(p_id INT(2) NOT NULL auto_increment,
company_name varchar (50),
id INT(3) NOT NULL,
Project_title varchar (100),
total_grant float (8),
partner_company varchar(100),
end_date DATE,
c_name varchar (15),
c_pass varchar (15),
a_name varchar (15),
a_pass varchar (15),
UNIQUE KEY p_id (p_id)
)
auto_increment=1 TYPE=MyISAM;


I get the error as
"Couldn't add data to add to "Create Project" table: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax …

tryphy 0 Junior Poster in Training

You need a sorting column.
Your company table can autoincrement with the id
Your project table should also auto increment but it won't start again - you need an extra two columns
COMPANY TABLE
COLUMNS: [id (autoincrement)], [Company_name]

PROJECT TABLE
COLUMNS: [projectID (autoincrement)], [companyID (Integer-foreign key)], [Sort (integer)]

every time a project is added, you need to select the MAX sort value from project table where companyID=selected company id. Add one to that value and use it for the insert of your project record.

Suggest you keep your creation of users and passwords to a separate process so that you can select people from a pulldown list on this page based on the chosen company.

In your add user section, you need to check on usernames only for duplicate, ignoring password.

so back to your project page - you need a project members table:
Columns: [projectID (INT foreign key)], [memberID (INT foreign key)], [project role (description such as 'Project Manager')]

Hey
Thanks,
For ur reply..
That was the same idea i was thinking...when i worked it out it gives me a Duplicate error...

tryphy 0 Junior Poster in Training

A):
First I have a company form, which i create a company name and it is saved in a company table..with an autoincrement id as 001( I used Zerofill in it.)
Creating the company --> I did this..


B):
Then, I have a project form which create project details, in this i have a company field, which can be selected from a drop down list.. I have a project table where is stores the project form details..

I want the project id to be 01, 02...and so on..Each company can have many projects..

eg:
C1 - P1, P2 (id : 01, 02,..)
C2 - P1 (id : 01,..)
C3 - p1, p2, p3 (id: 02..)

Everytime the project is created for a particular company i want the project id to be 01, 02..
If new project from new company then its again 01, 02..and so on..


And also need another validation check in image (B). There are some login field. Every time when the project is being created must check that the username and password doesnt already exists..

Mainly I need to find out the (B) part.

Can any1 help me out to solve this?

Thanks in advance.

tryphy 0 Junior Poster in Training

yes there is a way, but its easier with javascript
the key is the "return confirm"

<form action="something.php" onSubmit="return confirm('Are you sure?');" method="post">
// Fields
// Fields
<input type="submit" name="Submit" class="button" value="Submit">
</form>

I hope this helps

Hey thanks,

Yah i used Javascript to solve it..
:)

tryphy 0 Junior Poster in Training

AUTO_INCREMENT can only be numeric. For leading zeros you can set the field to ZEROFILL.You should concatenate character while displaying the data.

Hi mwasif,

Thanks, i used as numeric field and used Zerofill..
It helped me a lot..
Thanks again

tryphy 0 Junior Poster in Training

Hey guys,
Thanks for ur help...I managed to solve it...
I used Zerofill..
Thanks again guys..

tryphy 0 Junior Poster in Training

Hi people,

My issue is more of a MySQL issue than php.
I am trying to store a 3digit integer value with a leading Zeros in front such as 001

i have a company table , which auto increments the id as 001, 002, 003...and so on...
In the company table i also have a country radio box..
Which has two country names,
eg: India, Australia..

So when creating the company..
The user types in the data and select a country eg: India,
The Id should be I001,
The next record if he chooses Australia,,, then it will be
A002 ... A003, I004..and so on...till A999(as the last record).

Can anyone help me how to implement this?..

Ur help is much appreciated...
Thanks in advance..

tryphy 0 Junior Poster in Training

Hi people,

My issue is more of a MySQL issue than php.
I am trying to store a 3digit integer value with a leading Zeros in front such as 001

i have a company table , which auto increments the id as 001, 002, 003...and so on...
In the company table i also have a country radio box..
Which has two country names,
eg: India, Australia..

So when creating the company..
The user types in the data and select a country eg: India,
The Id should be I001,
The next record if he chooses Australia,,, then it will be
A002 ... A003, I004..and so on...till A999(as the last record).

Can anyone help me how to implement this?..

Ur help is much appreciated...
Thanks in advance..

tryphy 0 Junior Poster in Training

How to check the username and password from all the tables that are created..

Can any1 help in this..
Please..

Thanks,
tryphy..

tryphy 0 Junior Poster in Training

problem is on expirtion date which you are entering value in text field. give 0000-00-00 this format.

#
<p>Expiry Date

<input type="text" name="scredit_card_expiration_date">

</p>

Hi kalpana,

I tried deleting the expiration date field and tested...Its still the same problem...

tryphy 0 Junior Poster in Training

I have a multi form...
I searched online and found this link...
http://www.html-form-guide.com/php-form/php-order-form.html

so i was doing a test, but it didnt work for me..
Can some1 help me, where i have gone wrong.
Here are my codes....

Form1.php

<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>form1</title>
</head>

<body>
<form method="post" action="form2.php">
    <p>
      <input type="text" name="sname">
  Name</p>
    <p>
      <input type="text" name="semail_address">
  Email</p>
    <p>
      <input type="submit" value="form 2">
            </p>
</form>
</body>
</html>

Form2.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form2</title>
</head>

<body>
<?php

//let's start the session
session_start();

//finally, let's store our posted values in the session variables
$_SESSION['name'] = $_POST['sname'];
$_SESSION['email_address'] = $_POST['semail_address'];
?>
<form method="post" action="form3.php">
	<p>
	  <input type="radio" value="Free" checked="checked" name="smembership_type">
  Free</p>
	<p>
	  <input type="radio" name="smembership_type" value="Normal">
  Normal</p>
	<p>
	  <input type="radio" name="smembership_type" value="Deluxe">
	  Deluxe</p>
	<p>
	  <input type="checkbox" name="sterms_and_conditions">
  I agreee</p>
	<p>
	  <label><a href="#" onclick="history.go(-1);return true;">BACK</a> </label>
	  <input type="submit" value="Form 3">
  </p>
</form>
</body>
</html>

Form 3.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form3</title>
</head>

<body>
<?php

//let's start the session
session_start();
$_SESSION['membership_type'] = $_POST['smembership_type'];
$_SESSION['terms_and_conditions'] = $_POST['sterms_and_conditions'];

?>
<form method="post" action="form_process.php">
  <p>Name on Card:
    <input type="text" name="sname_on_card">
  </p>
  <p>
    Credit card Number
    <input type="text" name="scredit_card_number">
  </p>
  <p>Expiry Date
    <input type="text" name="scredit_card_expiration_date">
  </p>
  <p>
	  <label><a href="#" onclick="history.go(-1);return true;">BACK</a> …
tryphy 0 Junior Poster in Training

Does any1 know how to make it work...?
Any Help...

Thanks.

tryphy 0 Junior Poster in Training

Hi friends,
I have a major doubt: Could you please help me with this...

I have a create company form, create project form..
In the create company form, it creates the company name and a company code for it..and in the project form, i have one field as option value, which takes the company name from the company form and populates in and also a project code..In the same create project form, i have 4 other fields as:
user A- name:
User A - pass:

User B - name:
User B- pass :

Which is basically v cannot create a project b4 creating a company.On company can have more than one projects

eg:
C1 - P1 - 2 username, 2 passwords
C2 - P1 - 2 username, 2 passwords
- P2
C3 - P1
- P2
- P3
================================================
I want the company code to be like - 1001 and auto increment:
so what i did was, when creating the company, i create a table for each company with the company name as table name:while doing this, i also insert the values to a standard table "create_company"..in which i have the auto-increment code and company name:

Then when creating project, that particular project details will be entered into that particular company tables...
It all works good for me...
================================================
The project code is 01, 02..
Can v …

tryphy 0 Junior Poster in Training

Hi whiteyoh,

ur code helps..thanks a lot..but there is somewhere some mistake...
which i coudnt able to find it out..
the form button appears sometimes, sometimes get disappeared...
i dont know why ?
Below are my codes:
userlogin_sucess.php

<?php
session_start();
?>
<ul>
<li><a href="report1.php">main</a></li>
<p>
  <?php if ($_SESSION['submit'] =="") 
                 { 
				 echo "<li><a href='report1.php'>FORM</a></li>";
                 }
				 else if($_SESSION['submit'] =="sent") 
				 { 
				 echo "None";
				 //exit();
				 }
				 ?>
</p>
</ul>

This on click of the FORM link, it goes to next page..where i enter the form details and submit... On submit of the form it process the reportform_process.php in the form action of the report page..

reportform_process.php

<?php
session_start();
//the forms has been sent
echo "Thanks, your info has been recieved";
//$_SESSION['submit'] = "sent";
?>
<style type="text/css">
<!--
.style1 {
	color: #FF0000;
	font-weight: bold;
}
-->
</style>
<table width="960" border="0">
  <tr>
    <td width="391">Home</td>
    <td width="276">Submitted forms</td>
    <td width="279"><p><a href="logout.php">Logout</a></p></td>
  </tr>
</table>
<p><span class="style1">your data has been successfully submitted.</span>
  <?php
$db = "db";
$link = mysql_connect("localhost","root","");
if (!$link)
{
die("Couldn't connect to MySQL");
}

mysql_select_db("db",$link)
or die("Couldn't open $db: ".mysql_error($link));
$raddress = $_POST["add"];
$rname = $_POST["top_name"];
$rdesignation = $_POST["top_desig"];
$remail = $_POST["top_email"];
$rtelephone = $_POST["top_telephone"];
$rtotal_grant= $_POST["top_grant"];
$rcountry = $_POST["ucountry"];
$submit = $_POST["button"];
?>
  
  
  <?php
  $query = "INSERT INTO user_report(address, tname, desig, email,telephone, total_grant, country ,sbutton)"."VALUES('$raddress', '$rname' , '$rdesignation' , '$remail' , '$rtelephone' , '$rtotal_grant' , '$rcountry' , '$submit')";
 $_SESSION['submit'] = "sent";
  //$_SESSION['submit'] = $submit;
				mysql_query($query,$link)
					or die("Couldn't add data to add to \"Report Form\" table: 
".mysql_error($link));

				mysql_close($link);
				?> …
tryphy 0 Junior Poster in Training

sorry line 7 on first lot of code should say

== "")

Hi thanks for ur code... looks it might get work.. but somewhere i m going wrong....

After the user login in... he goes to this page:
test.php

<?php
session_start();
?>
//start of menu
<ul>
<li><a href="report1.php">main</a></li>
<?php if ($_SESSION['submit'] =="") 
                 { 
				 echo "<li><a href='report1.php'>FORM</a></li>";
                 }
				 else
				 { 
				 echo "None";
				 //exit();
				 }
				 ?>
</ul>

When i run the previous code, I can see the "Main" and the None...i cannot see the <li> of the "FORM"....
then when the user click on "Main" it goes to report1.php
where i have my form
report1.php

<?php
session_start();
//the forms has been sent
echo "Thanks, your info has been recieved";
$_SESSION['submit'] = "sent";
?>
<html>
<head>
<title>Untitled Normal Page</title>
<SCRIPT LANGUAGE="JavaScript">
      function confirmAction() {
        return confirm("Do you really want to submit this form?")
      }
   function checkme() {
missinginfo = "";
if (!document.form.agree.checked) {
missinginfo += "\n - You must agree to the terms";
} 
if (missinginfo != "") {
missinginfo ="---\n" +
"Required information is missing: \n" +
missinginfo + "\n---" +
"\nPlease complete and resubmit.";
alert(missinginfo);
return false;
}
else { 
return true;
}
}


</SCRIPT>
</head>

<body>
<p><strong>REPORT 1<br />
</strong>*********</p>
<form method="post" action="reportform_process.php" onSubmit="return confirmAction()">
  <strong>
  <label>  </label>
  </strong>
  <label>Address :
  <input type="text" name="add" id="add" />
  </label>
  <p>Name : 
    <input type="text" name="top_name" id="top_name" />
  </p>
  <p>Designation : 
    <input type="text" name="top_desig" id="top_desig" />
  </p>
  <p>Email :
    <input type="text" name="top_email" id="top_email" />
</p>
  <p>Telephone : 
    <input type="text" name="top_telephone" id="top_telephone" /> …
tryphy 0 Junior Poster in Training

A session is a global variable which allows information to be held until the session is ended.

An important thing to remember is that at the top of each page where a session is used you should use session_start();

<php?
session_start();
?>
//start of menu
<ul>
<li><a href="index.php"/>main</a></li>
<?php if ($_SESSION['messagesent'] !="") 
                 { echo "<li><a href="sendmessage.php"
                 }else{ exit();?>
</ul>

This will only show that list item if the session is not empty

On your form, when sent you could have some logic to say if the session == something then say "thanks for filling this in"

function disable()
{
document.getElementById("button").style.display = "none";
				
	}

try like this.

I tried that.. but still doesnt work..

tryphy 0 Junior Poster in Training

Hi saiprem, Could u help me with the code...
Just a simple one... Then i could understand that and carry on...
Pls...
Thanks...

tryphy 0 Junior Poster in Training
<php?
session_start();
?>
//start of menu
<ul>
<li><a href="index.php"/>main</a></li>
<?php if ($_SESSION !="")
{ echo "<li><a href="sendmessage.php"  HOw about this line ? IS there any error in it                }else{ exit();?>
// In this after the exit(); havent closed with }
</ul>

This will only show that list item if the session is not empty.
wat value is the session calling? $_SESSION --- In this what is message sent.

On your form, when sent you could have some logic to say if the session == something then say "thanks for filling this in"
Explain the above line? Is it in the form page..? must we use session in the form page also... then how is the session called in...?

tryphy 0 Junior Poster in Training

you could try creating a session $_SESSION; which could hold a boolean value.

On clicking the button, give that variable a value, and the same on each page. if it has a value, dont show the button, if it doesnt then do

Hey ,
I coudnt able to understand it... and i m not that gud in using sessions... Could u pls help me with the sample codes...

Thanks...

tryphy 0 Junior Poster in Training

Hi

I have this login page where user enters in and goes to main page, it has a button called enter form >> which on clicks go to a form submission page .

The user enters the form and click submit, once he click submit the form is submitted and in the previous page(which is the main page) the enter form >> button is disabled.

What i have done is i took the value of the submit button from the form page and store in the database.

Then in the previous page(which is the main page), i did a if condition that if the value is submit, disable the enter form >> button...But i think i have some errors in it... it doesnt show any error, but the enter form >> button is not disabled...

Login page >> Main Page(which has the enter form > button) >> Form Page >>

I tried using some javascript also but no idea.....hmm...

My code is as

<script language="javascript">
function disable()
{
document.form1.button.disabled = true;
}
</script>

</head>

<body>
 <?php
$db = "db";
$link = mysql_connect("localhost","root","");
if (!$link)
{
die("Couldn't connect to MySQL");
}

mysql_select_db("db",$link)
or die("Couldn't open $db: ".mysql_error($link));

$query = "SELECT sbutton FROM user_report";
//$result = mysql_query($query) or die(mysql_error());
$result = mysql_query($query);
$row = mysql_fetch_array($result);
//$ic=$row->sbutton;
//$ic=$row["sbutton"];
if ($row == 'Submit') 
{
echo "<SCRIPT LANGUAGE='javascript'>disable();</SCRIPT>";
//$disabled = 'disabled = "disabled"'; 
}
?>
<form id="form1" name="form1" method="post" action="report1.php">
  <label>
<input type="submit" name="button" id="button" value="Create Form"/>
  </label> …
tryphy 0 Junior Poster in Training

You need to maintain a flag in the database,saying that user has submitted the report or not
1)
Add two columns in database
last_send_date(datetime datatype)
submitted(either you can use boolean datatype or enum datatype)

The default value for submitted column in the table is 0
Once user submitted his report then make submitted field in the table to 1.(This is maintaining a flag, and this is used to check that particular user has submitted report or not, if yes it is not necessary to send him a auto responder message, else we need to send him a message)

To set up a cron just create a new page, in the page
2) Yes you need to create a new page in php, from this page you need to send the autorespons message to user

What is 0,30 - How to write the code for it....
How to check with today's date... ?
3) Immediately after admin is creating the users data, I think you are sending an email message to that user, am I right? If yes, After sending mail to that user, go to his record in database and add sent date to last_send_date column and user_created_date column
and then submitted column to 0.

set you cron to run once in a day

So coming to your cron page, get the users record data as

select usersdata.* , DATEDIFF( CURRENT_DATE, user_created_date) as delta from users usersdata where submitted=0

check delta …

tryphy 0 Junior Poster in Training

You need to maintain a flag in the database,saying that user has submitted the report or not,

>> How do we maintain a flag in database.. ?

and one more column for last_send_date

last_send_date of the report submitted is it....

To set up a cron just create a new page, in the page,
>> Creating a new page is in php right...

fetch all the users records whose flag is in status of not submitted, and check the details of that user when admin has created it,

If the user record is between 0,30 - send him a reminder message and maintain the send date in your users table.
What is 0,30 - How to write the code for it....
How to check with today's date... ?
For second time check the last sent date with today's date, if that is equals to 7
Why do we check it is equals to 7 >>

then resend him again a reminder and mark the date to today in the last_send_date column

tryphy 0 Junior Poster in Training

Basically it is..
I have a Admin page- > In this the admin wil be able to create a user by entering in his particulars:
eg: user name, password for the user, telephone and email address..
The user will able to login using this username and password. Once they log in, they see a form which has to be filled in by them,,..once they submit the form, the form details is passed on to the admin..If the user has sumitted the form, then its completed..

What i need is an Auto reminder for the users to remind them to fill in the report form and send it.. the email address is taken from the user table, that the admin has created...

eg: lets say the user has to submit the report on march
Then an auto reminder has to be sent on Feb 1st. If the user has not yet submitted the form, a 2nd auto reminder must be sent on Feb 7th. if again he hasnt submitted then another auto reminder has to be sent on Feb 21st..
So, total 3 auto reminders upon checking of conditions,....If the user has submitted the report no need to send auto reminders.

The server has to run the php script on its own..
I think this is done using CRONJOB in the cpanel..But i dont have any idea on it,,,I read through many resources, but coudnt get any idea... Can someone help..I need …