PDA

View Full Version : php help badly needed


johanzen
June 11th, 2006, 14:41
I am in no way an experienced php programmer but I thought I would be able to manage this task.
I have now tried on my own but with a very poor result. In fact my own work doesn't work at all :(
The best outcome so far has been a lot of time used try to figure it out alone.

Here is the task:

I got a data base on my local server called _random
I got the wanted information in a table called tr_members

Connection string:
$dbh=mysql_connect ("localhost", "sporto00_random", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("sporto00_random");

I want to build a page that can be used by all the members but having their individual referral ID# and form information
( http://www.whatever.com/splash1.php?from=members_id )

The page should hold a form much like this

<form name="xxxxxxxxxxxxx" method="post" action="http://www.xxxxxxxxxxxxx.com/autosubscribe.htm">
<input type="hidden" name="campaign" value="" />
<input type="hidden" name="account" value="" />
<input type="hidden" name="required" value="" />
<input type="hidden" name="success" value="" />
<input type="hidden" name="alreadyin" value="" />
<input type="hidden" name="failure" value="" />
<input type="hidden" name="adcode" value="" />
<input name="user1" type="hidden" value= the members ref id />
<input name="user2" type="hidden" value= the members first name />
<input name="user3" type="hidden" value= the members last name />
<input name="user4" type="hidden" value= the members address />
<input name="user5" type="hidden" value= the members email address />
<input type="text" name="firstname" size="18" />
<input type="text" name="lastname" size="18" />
<input type="text" name="email" size="18" />
<input type="submit" name="Submit22" value="Submit" />
</form> -->

Whould anyone please help me out on this one. I'm totally stuck.

I would even be happy to pay should any fees be involved.

Regards
Michael

:)

johanzen
June 12th, 2006, 06:11
Any ideas of were I could get the help if not here?

Michael

chaos
June 12th, 2006, 06:25
Unfortunately, I myself cannot help you, and although I do not doubt that Paul will be around some time to help, I have decided to give you what aid I can.

A few sites worth trying for help are:
http://www.phpfreaks.com/A Forum/Tutorial Hub for PHP

http://forums.devnetwork.net/ The PHP Dev Network might be able to help

http://www.codingforums.com/forumdisplay.php?f=6 (http://www.codingforums.com/forumdisplay.php?f=6)
Another PHP coding forum

Now, don't take my word on any of these, as I havn't personally used them. They are just the result of a quick Google search, but they do appear to suit your needs on first glance. That said, I wouldn't give up hope here, as although this forum can move pretty slow at times, once people discover your thread you will get a flock of results.

rich w
June 12th, 2006, 08:39
Not tested this code but it should work (bear in mind it's also 7:30AM):


<?php
$dbc = @mysql_connect ('localhost', 'sporto00_random', '<PASSWORD HERE>') OR die(mysql_error());
@mysql_select_db ('sporto00_random') OR die(mysql_error());
function errordig() {
echo "<div style=\"background-color:pink; width:145px; padding:5px\">Member ID was not set</div>";
}

function exequery($query) {
$result = @mysql_query($query) OR die(mysql_error());
if (!$result)
die(mysql_error());
return $result;
}

function stripstring($string) {
$string = stripslashes($string);
return $string;
}

if(isset($_GET["from"])) {
if (ereg("^[0-9]+$", $_GET["from"])) {
$from = $_GET["from"];
$query = "SELECT * FROM `tr_members` WHERE `members_id`='$from'";
$result = exequery($query);
$cur_row=mysql_fetch_assoc($result);
echo "<form name=\"xxxxxxxxxxxxx\" method=\"post\" action=\"http://www.xxxxxxxxxxxxx.com/autosubscribe.htm\">
<input type=\"hidden\" name=\"campaign\" value=\"\" />
#<input type=\"hidden\" name=\"account\" value=\"\" />
<input type=\"hidden\" name=\"required\" value=\"\" />
<input type=\"hidden\" name=\"success\" value=\"\" />
<input type=\"hidden\" name=\"alreadyin\" value=\"\" />
<input type=\"hidden\" name=\"failure\" value=\"\" />
<input type=\"hidden\" name=\"adcode\" value=\"\" />
<input name=\"user1\" type=\"hidden\" value=\"".$cur_row["refid"]."\" />
<input name=\"user2\" type=\"hidden\" value=\"".stripstring($cur_row["firstname"])."\" />
<input name=\"user3\" type=\"hidden\" value=\"".stripstring($cur_row["lastname"])."\" />
<input name=\"user4\" type=\"hidden\" value=\"".stripstring($cur_row["address"])."\" />
<input name=\"user5\" type=\"hidden\" value=\"".stripstring($cur_row["email"])."\" />
<input type=\"text\" name=\"firstname\" size=\"18\" />
<input type=\"text\" name=\"lastname\" size=\"18\" />
<input type=\"text\" name=\"email\" size=\"18\" />
<input type=\"submit\" name=\"Submit22\" value=\"Submit\" />
</form>";
}
else
errordig();
}
else
errordig();

exit();
?>

jos
June 12th, 2006, 08:57
In addition to chaos's comment: Pick any forum/network you'd like to join but your 2 best friends beside that network/forum will be:

www.w3schools.com (try the learn php section)
www.php.net (this (official) website contains EVERYTHING in details, if you don't understand something, it's explained here with lots of details and comments)

Now to your problem, first off: what is the problem? You showed us none of your php code (except the connection to the database), as I understand it, you want some 'members' area with each member having an account? So basicly you need a login script with additional member info.

The referring ID is no problem, if you create a database (mysql) you can set the first field of your table to primary key & auto increment. Any account that registers will automaticly have it's own id. Make sure the field type is INT (integer) and set the lenght to 11.

All this is really basic PHP, I'd advise you to start learning it yourself you can start with the login script, there are tons of existing loginscripts out there which you can use as a guide, take the 2 url's I gave you and enjoy a couple of days of PHP and you'll get the hang of it.