Home > General > Affiliate Marketing Forum

Need Some Coding Help For My Page? (10)


07-19-2011 06:58 PM #1 jroes57 (Member)
Need Some Coding Help For My Page?

So I have been trying to make my page link into a coreg path and right now I am at step 2:

http://www.bestpromotionsdaily.com/ppv/FV/new/test3.php

I know there is a spelling mistake but I am more concerned about the code right now.

Code:
<form id="form1" name="form1" method="get" action="http://www.silver-path.com/path.php?src_key=a4w2b4p22343v294">
After hitting the submit button and having the data popped into the variables the src_key= is getting stripped out. Does anyone know why?


07-19-2011 07:01 PM #2 hd2010 (Member)

method="get" should be method="post", try with a test page, your form data will be posted and available in $_POST, normally form uses POST


07-19-2011 07:03 PM #3 jroes57 (Member)

Do i need to save the data anywhere in order to pass it along?


07-19-2011 07:36 PM #4 hd2010 (Member)

the form data is the data that the visitor fill in when they click the submit, no saving needed, everything is happend on the fly when the submit button is clicked, no database involve


07-19-2011 07:38 PM #5 IvanOng (Member)

lol... i have no idea what you guys are talking about... but hd2010 is a hardcore programming geek... so he'll be able to help you...


07-19-2011 08:47 PM #6 jroes57 (Member)

Thank you!
Now the last problem is passing the data through the variables:
http://www.silver-path.com/path.php?...=mobile_number

I renamed each one of those to the input field, now how do you dynamically replace those?


07-20-2011 03:05 AM #7 hd2010 (Member)

<form id="form1" name="form1" method="get" action="http://www.silver-path.com/path.php?src_key=a4w2b4p22343v294">

Just to claify what I said,

The method you used, should be depend on the CPA network 's prepop guide, inside the guide, you will be told to use "get" or "post", mostly is "get"

This is easily to identify even without the guide by just looking at the destination url of the form, whether what kind of url is expected : if the url is expected something like : http://www.somedomain.com/path.php?p...3=param_value3, then "get" method must be used

If the url is expected in this format : http://www.somedomain.com/path.php. which mean no query string appended in the url, then post method is needed

it is better to confirm with the guide.

the variables you are asking to pass along will be mostly the 5th one, hence the url will be : http://www.silver-path.com/path.php?...=mobile_number

the dynamic replace those are actually done by php, that why php is called a programming languange to create a dynamic site ( a site which content change on fly or always change )

inside your form page, the page needed to be in php script and have a file extension : .php

hence here is the sample code :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>

<body>

<form name="form1" method="get" action="<?php echo "http://www.silver-path.com/path.php?src_key=a4w2b4p22343v294&first_name=".$_G ET['first_name']."&last_name=".$_GET['last_name']."&email=".$_GET['email']."&mobile_number=".$_GET['mobile_number']; ?>">
<p>
<label for="textfield"></label>
First Name :
<input type="text" name="first_name" id="textfield">
</p>
<p>
<label for="textfield2">Last Name :</label>
<input type="text" name="last_name" id="textfield2">
</p>
<p>
<label for="textfield3"></label>
Email :
<input type="text" name="email" id="textfield3">
</p>
<p>
<label for="textfield4"></label>
Mobile number :
<input type="text" name="mobile_number" id="textfield4">
</p>
</form>
</body>
</html>


?>


07-20-2011 03:14 AM #8 hd2010 (Member)

ignore the bottom ?>, you can add a script in between the form and the prepop offer.


07-20-2011 03:37 AM #9 jroes57 (Member)

Heres where I am at now after multiple suggestions:

Code:
<div style="position:absolute; top:332px; left:325px;"><form id="form1" name="form1" method="get" action="step2.php"><table width="400" border="0">
  <tr>
    <td width="150">First Name:</td>

    <td width="240">
      <label for="First Name"></label>
      <input type="text" name="first_name" id="first_name" />
    </td>
  </tr>
  <tr>
    <td>Last Name:</td>
    <td>

      <label for="Last Name"></label>
      <input type="text" name="last_name" id="last_name" />
    </td>
  </tr>
  <tr>
    <td>Email Address:</td>
    <td>
      <label for="Email"></label>

      <input type="text" name="email" id="email" />
   </td>
  </tr>
  <tr>
    <td>Cell Phone: </td>
    <td>
      <label for="phone"></label>
      <input id="phonea" class="text" type="text" onkeyup="jump1(this)" style="width: 35px;" name="phonea" maxlength="3" value="">
<input id="phoneb" class="text" type="text" onkeyup="jump2(this)" maxlength="3" style="width: 35px;" name="phoneb" value="">
<input id="phonec" class="text" type="text" maxlength="4" style="width: 50px;" name="phonec" value="">

    </td>
  </tr>
    <tr>
    <td colspan="2"><center><input type="image" src="btn_submit.gif" border="0" style="display:inline;" class="submit"/>
    </center></td>
    </tr>

</table></form></div>
On step2.php
Code:
<?
$first_name = $_GET['first_name']; // extract variables from URL and assign value
$last_name = $_GET['last_name'];
$email = $_GET['email'];
$phonea = $_GET['phonea'];
$phoneb = $_GET['phoneb'];
$phonec = $_GET['phonec'];
    

$firstname = ucwords(strtolower($first_name)); // Capitalize first letter of first name
$lastname = ucwords(strtolower($last_name)); // Capitalize first letter of last name
?>
<html>
<body>
<iframe src="http://www.silver-path.com/path.php?src_key=a4w2b4p22343v294&first_name=<? echo $first_name; ?>&last_name=<? echo $last_name; ?>&email=<? echo $email; ?>&mobile1=<? echo $phonea; ?>&mobile2=<? echo $phoneb; ?>&mobile3=<? echo $phonec; ?>&exit_url=http://affiliate.lfmtracker.com/rd/r.php?sid=2250&pub=170140&c1=exit" align="middle" height="768" width="1024"></iframe>

</body>
</html>
Everything passes but the mobile number, the mobile number will pass incorrectly if I add a (-) inbetween any of the numbers but then the number will be invalid. Any reason why its doing this?


07-20-2011 03:42 AM #10 hd2010 (Member)

because certain characters in url have special meaning, if you want to pass it as literal, you have to encode first the character, then decode if needed.

http://php.net/manual/en/function.urlencode.php


Home > General > Affiliate Marketing Forum