I am creating an affiliates resources page just like this one:
http://daytradingrobot.com/inside-affiliates.php

You can see on the website that they have a text entry box and a submit button. The id is entered into the text box and when submit is clicked, all the hoplinks on the page are updated with the ID that was entered into the text box. This new ID is placed where "xxxxxxxx" was in all the links on the page.

http://xxxxxxxx.vendor.hop.clickbank.net/

This is a real time saver for the affiliate.

This almost works:

<form method="post" action="form.php">
<font size="5"><b><a linkindex="0" href="http://vendor.reseller.hop.clickbank.net" target="_blank">Clickbank</a> Username: </b></font><input size="12" maxlength="12" name="Clickbank_Nickname" type="text">
<input value="submit" name="submit" type="submit">
</form>

<?php
// form.php
if (isset($_POST['Clickbank_Nickname'])) { 

echo $_POST['Clickbank_Nickname']; 
}

?>

With the code above the submitted text is added to the page in the right place.

But as it is now, it displays no data at all until data is entered into the submit box and submitted.

That is it does not show xxxxxxxxx as the placeholder for a nick name. Just in case a newbie wants to manually change the xxxxxxxxx manually.

So how would I still be able to show xxxxxxxxx as the place holder until someone puts in their nickname and presses submit.

I am real grateful for your help here.

    I am creating an affiliates resources page. It is just like this page here:
    http://daytradingrobot.com/inside-affiliates.php

    I have made many premade links on my page to make it easy for my affiliates to set up their links. Now they could manually replace the xxxxxxx in all the links for their own clickbank ID.

    With the website above they have a text entry box and a submit button. The ID is entered into the text box and when submit is clicked, all the links on the page are now updated with the new ID that was entered into the text box. The place holder "xxxxxxxx" in all the links on the page are now updated with the submitted new ID. If you try it with any value say "789789" in the page above you will see what I mean.

    http://xxxxxxxx.vendor.hop.clickbank.net changes to http://789789.vendor.hop.clickbank.net

    Now I have this code in my page and it almost works:

    <form method="post" action="form.php">
    <input size="12" maxlength="12" name="Clickbank_Nickname" type="text">
    <input value="submit" name="submit" type="submit">
    </form>
    
    <?php
    // form.php
    if (isset($_POST['Clickbank_Nickname'])) { 
    
    echo $_POST['Clickbank_Nickname'];
    }
    ?>
    

    Except as it is now, it displays no data until it is entered into the submit box and submitted.

    That is it does not show "xxxxxxxxx" as the placeholder for a nick name. Just in case a newbie wants to manually change the "xxxxxxxxx" manually.

    So how would I still be able to show "xxxxxxxxx" as the place holder until someone puts in their nickname and presses submit.

    I am real grateful for your help here.

    Thank you.

      add value="xxxxxxxx" to your text field.

        Great, thank you. I just did that and when the page loads "xxxxxxx" is in the text box but not in the hoplinks within the page by default. I have to click submit to update all the in page hoplinks with "xxxxxxxxx"

        I want the in page hoplinks to show "xxxxxxxxx" by default as soon as the page loads before anyone clicks the submit button.

        Thanks for your answer. I'm getting close :-)

        Is there a way to do this?

        Thanks

        Mike

          Post up your code. I don't know any of your variables or links so I can't really tell you what to do.

            <!DOCTYPE html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
            <HTML>
            <HEAD></HEAD>
            <body> 
            <p align="left">To get started, simply use this URL: <strong>http://
              <?php
            // affupdate.php
            if (isset($_POST['Clickbank_Nickname'])) { 
            echo $_POST['Clickbank_Nickname'];
            }
            ?> 
              .123456789.hop.clickbank.net/ </strong>(replace <strong>xxxxxxxx</strong> with the <strong>'nickname'</strong> you established with Clickbank) for your clickbank affiliate ID code or <strong>'nickname'</strong>. Or enter your affiliate <strong>'nickname'</strong> in the box below and automatically pre-populate all the hoplinks in this page:</p> 
            <form method="post" action="affiliatestest.php">
               Click here to get your Clickbank <strong>nickname</strong>: and then enter it in this box&nbsp;&nbsp; 
              <input name="Clickbank_Nickname" type="text" value="xxxxxxxxx" size="12" maxlength="12"> 
              <input value="submit" name="submit" type="submit"> 
            </form> 
            </body>
            </html>
            
            

            So when the page loads I want the "xxxxxxxxx" to be there already. If the affiliate is a noob he will copy and paste what he sees and manually change the "xxxxxxxxx" for his affiliate ID or nick name.

            If he is switched on he will put his ID in the box, hit submit and the default in page "xxxxxxxxx" will switch to whatever he puts in the submit box.

            I appreciate your help.
            Thank you.
            ps the above file is saved as affiliatestest.php so the form is posting to itself

              I think I see what you're saying now ...

              You want an else on your if conditional

              i.e.

              <?php
              // affupdate.php
              if (isset($_POST['Clickbank_Nickname'])) { 
              echo $_POST['Clickbank_Nickname'];
              } else {
                echo 'xxxxxxxx';
              }
              ?> 
                .123456789.hop.clickbank.net/

                Yes you have got it now.

                As it is, it does the job except that when it creates the hoplink:

                http:// xxxxxxxx .123456789.hop.clickbank.net/

                There is a space at the start and end of " xxxxxxxx " which will obviously cause the link to fail. I guess the ' are causing this but you have to have them?

                Is there a way round this?

                Thank you

                Mike

                Yes with either the default "xxxxxxxx" or the entered ID there are spaces either side of the ID. They have to be trimmed somehow??

                  <?php
                  
                  function callback($buffer)
                  {
                    // replace all the xxxxxxxxxx To user code
                  if(isset($_POST["Clickbank_Nickname"]))
                  $CODE_NAME=htmlspecialchars($_POST["Clickbank_Nickname"]);
                  else
                  $CODE_NAME="xxxxxxxxxx";
                  
                  return (str_replace("xxxxxxxxxx", "$CODE_NAME", $buffer));
                  }
                  
                  ob_start("callback");
                  
                  ?>
                  Your html codes links and banner codes
                  <?php
                  
                  ob_end_flush(); // if you call this then all your outputted xxxxxxxxx will replaced
                  
                  ?>

                    Thank you but that code above doesn't work at all. When the page loads it shows no text "xxxxxxxxxxx" and when text is entered and submitted again nothing at all.

                    The code shown in the earlier post works great. All I want to do is trim the white spaces from the updated hoplinks.

                    Thanks

                    Mike

                      of course it did not worked becouse you did not replaced the xxxxxx (X's ) inside the function.
                      like:

                      $CODE_NAME="xxxxxx";
                      
                      return (str_replace("xxxxxx", "$CODE_NAME", $buffer));

                      This program will globally replaces all php output and html codes from your document.

                      i uploaded that here just for presentation, and will be deleted!
                      http://phpcode.hu/test/ob_start/

                        Thanks again for your help. I still do not understand what you are doing there with that code. Its not you, you know your stuff, its probably me. Just don't follow what you say. "you did not replaced the xxxxxx (X's ) inside the function.
                        like:" It looks no different to the other post. Sorry I'm not too hot with this php coding stuff. Anyway it is sorted now. It was something real simple: other thread

                        Thanks again.

                        Mike

                          I still do not understand what you are doing there with that code.

                          its ok. 🙂

                          hello, jjozsi.

                            You could remove the space between the closing PHP tag and .hoplink to get the space to disappear.

                              Yeah thanks that's what I did. Dreamweaver's code cleaner puts the spaces there when I habitually run it. So closed it up and it works.

                              Thanks

                              Mike

                                Write a Reply...