Jump to content

PHP Newbie, Copy from one page to another


hellophp

Recommended Posts

Hello All,

 

I am so new to php that it isnt even funny.

 

I am trying my first modification to a store I am working with.

 

I have a page that shows a customers data. I just want to copy the data, like the first and last name address to a checkout page, so orders for existing customers can be taken over the phone.

 

 

Here is the page that I first see with the data I am looking at:

 

<form name="frmUser" action="admin.php?p=user_process" method="post" onsubmit="return CheckUserForm(this)">
<input type="hidden" name="uid" value="<?=$uid?>">
<input type="hidden" name="mode" value="update">
<div id="idTabSheetMain" class="sheetActive" style="padding:0px;margin:0px;">
<table width="100%" cellpadding="0" cellspacing="5" border="0">
<tr>
	<td class="formHeader" colspan="2">
		<div class="formHeaderIcon"><img src="images/icons/ic_contact.gif"></div>
		<div class="formHeaderText">Contact Information</div>
	</td>
</tr>
<tr>
	<td class="formItemCaption"><b>First Name</b></td>
	<td class="formItemControl"><input type="text" name="fname" value="<?=htmlspecialchars($fname)?>" style="width:250px;"></td>
</tr>
<tr>
	<td class="formItemCaption"><b>Last Name</b></td>
	<td class="formItemControl"><input type="text" name="lname" value="<?=htmlspecialchars($lname)?>" style="width:250px;"></td>
</tr>
<tr>
	<td class="formItemCaption">Company</td>
	<td class="formItemControl"><input type="text" name="company" value="<?=htmlspecialchars($company)?>" style="width:250px;"></td>
</tr>
<tr>
	<td class="formItemCaption">Phone</td>
	<td class="formItemControl"><input type="text" name="phone" value="<?=htmlspecialchars($phone)?>" style="width:250px;"></td>
</tr>
<tr>
	<td class="formItemCaption"><b>Email :</b></td>
	<td class="formItemControl"><input type="text" name="email" value="<?=htmlspecialchars($email)?>" style="width:250px;"></td>
</tr>
<tr>
	<td class="formHeader" colspan="2">
		<div class="formHeaderIcon"><img src="images/icons/ic_contact.gif"></div>
		<div class="formHeaderText">Account Information</div>
	</td>
</tr>

<?	if($settings["WholesaleDiscountType"] != "NO"){?>
<tr>
	<td class="formItemCaption">User Access :</td>
	<td class="formItemControl"><select name="level" style="width:250px;">
			<option value="0">Standard User</option>
			<option value="1" <?=$level=="1"?"selected":""?>>Wholesaler Level 1</option>
<?		if($settings["WholesaleMaxLevels"] != "1"){?>				
			<option value="2" <?=$level=="2"?"selected":""?>>Wholesaler Level 2</option>
<?			if($settings["WholesaleMaxLevels"] != "2"){?>				
			<option value="3" <?=$level=="3"?"selected":""?>>Wholesaler Level 3</option>
<?			}
	}?>
		</select>
	</td>
</tr>
<?	}?>
<tr>
	<td class="formItemCaption">Username (login)</td>
	<td class="formItemControl"><?=htmlspecialchars($login)?></td>
</tr>
<tr>
	<td class="formItemCaption">Last Action</td>
	<td class="formItemControl"><?=$session_date?></td>
</tr>
<?	if($settings["SecurityAccountBlocking"] == "YES"){?>
<tr>
	<td class="formItemCaption">Current account status</td>
	<td class="formItemControl"><?=$blocked=="Yes"?'<font color="red">Account is Locked</font>':"Account is Active"?></td>
</tr>
<tr>
	<td class="formItemCaption">Set New Account Status</td>
	<td class="formItemControl">
		[ <a href="admin.php?p=user&uid=<?=$uid?>&action=lock&blocked=<?=$blocked=="Yes"?"no":"yes"?>">Click here to <?=$blocked=="Yes"?"Unlock Account":"Lock Account for a ".$settings["SecurityAccountBlockingHours"]." hours"?></a> ]
	</td>
</tr>
<?	}
else{?>
<tr>
	<td class="formItemCaption">Current account status</td>
	<td class="formItemControl">Account is Active</td>
</tr>
<tr>
	<td class="formItemCaption">Set New Account Status :<br> <br> </td>
	<td class="formItemControl">
		<u>Account Blocking Feature is Disabled</u>
		<div class="formItemComment">
			To enable blocking feature please go to Cart Settings ><br>
			Global Cart Settings > Security Settings page
		</div>
	</td>
</tr>
<?	}?>
<tr>
	<td class="formItemCaption">Email Mode</td>
	<td class="formItemControl">
		<select name="email_mode" style="width:123px;">
			<option value="html" <?=$email_mode=="html"?"selected":""?>>HTML</option>
			<option value="text" <?=$email_mode=="text"?"selected":""?>>Text</option>
		</select>
	</td>
</tr>
<tr>
	<td class="formItemCaption">Email Newsletters</td>
	<td class="formItemControl">
		<select name="newsletters" style="width:123px;">
			<option value="Yes">Yes</option>
			<option value="No" <?=$newsletters=="No"?"selected":""?>>No</option>
		</select>
	</td>
</tr>
<tr>
	<td class="formItemCaption">Email Product Update</td>
	<td class="formItemControl">
		<select name="updates" style="width:123px;">
			<option value="Yes">Yes</option>
			<option value="No" <?=$updates=="No"?"selected":""?>>No</option>
		</select>
	</td>
</tr>
<?	if($cf_account){
	foreach($cf_account as $field){?>
<tr valign="top">
	<td class="formItemCaption"><i><?=$field["field_name"]?></i></td>
	<td class="formItemControl"><?=$field["value_translated"]?></td>
</tr>
<?		}
}?>
<tr>
	<td class="formHeader" colspan="2">
		<div class="formHeaderIcon"><img src="images/icons/ic_payment.gif"></div>
		<div class="formHeaderText">Billing Information</div>
	</td>
</tr>
<tr>
	<td class="formItemCaption"><b>Address Line 1</b></td>
	<td class="formItemControl">
		<input type="text" name="address1" value="<?=htmlspecialchars($address1)?>" style="width:250px;">
	</td>
</tr>
<tr>
	<td class="formItemCaption">Address Line 2</td>
	<td class="formItemControl"><input type="text" name="address2" value="<?=htmlspecialchars($address2)?>" style="width:250px;"></td>
</tr>
<tr>
	<td class="formItemCaption"><b>City</b></td>
	<td class="formItemControl"><input type="text" name="city" value="<?=htmlspecialchars($city)?>" style="width:250px;"></td>
</tr>
<tr>
	<td class="formItemCaption"><b>Country</b></td>
	<td class="formItemControl">
		<select id="billing_address_country" name="country" style="width:250px;" onchange="setUserState()">
<?	foreach($countries_states as $coid=>$country_data){?>
				<option value="<?=$coid?>" <?=$country == $coid?'selected="selected"':''?>><?=htmlspecialchars($country_data["country_name"])?></option>
<?	}?>

		</select>

 

 

Then I want to post it here:

 

<fieldset class="formFieldSet">
<legend class="formHeader">Billing Address</legend>
<div class="formContent">
<div class="formLine">
	<div class="formCaption">First Name :</div>
	<div class="formControl">
		<input class="formControlText" maxlength="24" type="text" name="billing_address[fname]" value=""/> *
	</div>
</div>
<div class="formLine">
	<div class="formCaption">Last Name :</div>
	<div class="formControl">
		<input class="formControlText" maxlength="36" type="text" name="billing_address[lname]" value=""/> *
	</div>
</div>

<div class="formLine">
	<div class="formCaption">Company Name :</div>
	<div class="formControl">
		<input class="formControlText" maxlength="36" type="text" name="billing_address[company]" value=""/> 		</div>
</div>

<div class="formLine">
	<div class="formCaption">Address Line 1 :</div>
	<div class="formControl">
		<input class="formControlText" maxlength="36" type="text" name="billing_address[address1]" value=""/> *
	</div>
</div>

<div class="formLine">
	<div class="formCaption">Address Line 2 :</div>
	<div class="formControl">
		<input class="formControlText" maxlength="36" type="text" name="billing_address[address2]" value=""/>		</div>
</div>

<div class="formLine">
	<div class="formCaption">City :</div>
	<div class="formControl">
		<input class="formControlText" maxlength="36" type="text" name="billing_address[city]" value=""/> *
	</div>
</div>

 

 

I have read tutorials, and have gotten myself in a bind. Any help would be greatly appreciated.

Link to comment
Share on other sites

on the page that you want to post the values on to you will first need to catch the posted data you want.  for the first and last names you have names these input box's fname and lname.

 

at the top of the page that you want these to be displayed on you will need (inside php tags)

 


$a = $_POST['fname'];
$b = $_POST['lname'];

 

this will then set the value of the variables to the values taken from the page before.

 

to display the variables inside the html you will need to put this were you want them displayed

 

<?=$a?>

 

so this line would look as follows

 

<div class="formCaption">First Name :<?=$a?></div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.