Giving pets a Gender

Forum
Last Post
Threads / Messages
Look - I don't know what your table looks like and I don't know the complete code. Can I see a screenshot of your table, please?
 
SieghartZeke said:
tommyk1210 said:
instead of your random number to select gender code, try this:

PHP:
<form id="form1" name="form1" method="post" action="">
  <p>
    <label>
    Male:</label>
    <label>
      <input type="radio" name="Genderselect" value="male" id="Genderselect_0" />
    </label>
    <br />
    <label>
    Female:</label>
    <label>
      <input type="radio" name="Genderselect" value="female" id="Genderselect_1" />
    </label>
    <br />
  </p>
</form>

$gender = $_GET[genderselect];

When i have puted this code in my page,i have get a error!
Why?

Sorry to meddle, but I know the problem
in that script you have things like this:
form id="form1"
"" shouldn't be used in this situation, replace all " with ' in that code
and $gender = $_GET[genderselect]; should be in doadopt.php

instead of that code try doing it this way:
go to adopt.php
look for the (original)
<form name='form1' method='get' action='doadopt.php'>
part and replace all between that and </form> with
PHP:
  <p>Adoptable Name: 
    <input name='name' type='text' id='name'>
    <input name='id' type='hidden' id='id' value='".$id."'>
    <input name='promocode' type='hidden' id='promocode' value='".$promocode."'>
  </p>
  <p>
    <label>
    Male:</label>
    <label>
      <input type='radio' name='genderselect' value='male' id='genderselect' />
    </label>
    <label>
    Female:</label>
    <label>
      <input type='radio' name='genderselect' value='female' id='genderselect' />
    </label>
    <br />
  </p>
  <p>
    <input type='submit' name='Submit' value='Adopt Me'>
</p>

then go to doadopt.php
find where you had the random gender choose thing and replace it with
PHP:
//The gender mod
$gender = $_GET[genderselect];

hope I helped you
 
Uhm thank you but when i have finde dthat you can get different character from the breeding,i don't want use...
 
Ok, I see what I did wrong here, I inserted the gender field in the wrong on place in the database. I think I'll go for the random gender since you can change there name but I do wish I could get the abandon script.

If any one has a copy of it I'd be ever so grateful.
 
I already fixed it, it turned out to be a problem with the database. It was storing the gender in trading and not gender so I deleted it and added it back with the code above as the last table.

It's working beautifully and I decided I liked the random gender to make breeding challenging but I'm still missing a abandon script.


--------------------
 
Look at the kill & the rename & think about it.. from there it is easy to do an abandon :)
 
I have the table and the abandoned pets go to the database I just have to work out how to make them appear on a page and be claimable. I figure it would be like the adopt.php only with added code and and stuff changed to point to the database were the abandoned pets are stored. For some reason there also dumping in to the table with no image is that normal?
 
That is normal but why a new table? They can stay in the owned adoptables table but if the owner field is blank then they are not owned and will not show up on anyones profile because they are abandoned. It a lot easier, especially when you are learning to use the wheel given you, not reinvent it. :):)

Sea
 
I recently added this mod to my site and it works somewhat. The row Gender does display correctly in the table. However, any pet I adopt has no gender, the row is always blank. I have also tried adding the values male and female to the row gender in the table owned_adoptables to no avail. Any help would be appreciated.
 
@Seapyramid

I had started to use the abandoned script posted here but the download was lost in the move now I'm to scared to mess with it and I don't know how to make the abandoned adoptable open to claim by other members. So now I have a DB with abandoned pets and nothing to do with them.
 
Roconza said:
@Seapyramid

I had started to use the abandoned script posted here but the download was lost in the move now I'm to scared to mess with it and I don't know how to make the abandoned adoptable open to claim by other members. So now I have a DB with abandoned pets and nothing to do with them.

Very simply.. set it up so when someone abandons it just updates to owned_adoptables... owner field to ""

Like this:

PHP:
mysql_query("UPDATE " . $prefix . "owned_adoptables SET owner='' WHERE aid='$id'");

Then when you have you page for them to take abandons... use something like..

PHP:
                $query2 = "SELECT aid,name,currentlevel FROM " . $prefix . "owned_adoptables WHERE owner = ''";

to show them & someting like

PHP:
        $query0 = "SELECT name,item FROM " . $prefix . "owned_adoptables WHERE aid='$id' LIMIT 1";
        $result0 = mysql_query($query0);
        $num0 = mysql_numrows($result0);
        switch (true) {
            //**************************************************
            // Adoptable Exists
            //**************************************************
            case ($num0 > 0):
                // <editor-fold defaultstate="collapsed" desc="Adoptable Exists">
                $row0 = mysql_fetch_assoc($result0);
                $name = $row0["name"];
                $item = $row0["item"];
                $image = "";
                if ($item != "yes") {
                    $image = getcurrentimage($id);
                } else {
                    $image = getcurrentitemimage($id);
                }
                $article_title = "Signing New Contract with " . $name . "<br /><br />";
                $article_content = "     You are signing a contract with " . $name . ". Doing so will require a signing bonus of 200 Gold Pieces. When you're ready to sign a contract with this Companion, click on the <i>Sign Contract</i> button below.<br /><br />
                <center><a href='levelup.php=" . $id . "'><img src='" . $image . "' border='0'></a></center><br />
                <form name='form1' method='post' action='doabandon.php'>
                <p><input name='aid' type='hidden' id='aid' value='" . $id . "'>
                <input name='name' type='hidden' id='name' value='" . $name . "'></p>
                <p><input type='submit' name='submit' value='Sign Contract'></p></form>";
                $_SESSION['abandon']=1;
                // </editor-fold>
                break;

when they adopt

Now I will say once again.. my code is HIGHLY OPTIMIZED & WILL NO LONGER WORK with the basic script!!

What I offer is some insight & direction.. not a "fix".

Sea
 
umm so this is 50% male and 50% female for all adoptables... Is it possible to specify that certain adoptables can only be male or female?
 
It is . I have now set up a gender system where gender is male, female or both.. if both it randoms & chooses a gender. It also has the option of setting gender for one pet & the alt the other gender, if main pet & alt are meant to be different sexes.
 
Here my problem...why i dont show the gender in the Myadopts page??
I Have added the code for show...but i dont show none!!!
WHy?
 
Thanks for sharing valuable code. As I have seen it had worked for some people and not for others. So I going to try it with positive feeling that it will work for me and revert back to you with update shortly.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,122
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top