Jump to content


Photo

Simple PHP help needed!


  • Please log in to reply
5 replies to this topic

#1 aceishigh

aceishigh
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 21 May 2006 - 03:39 PM

Hey,

I have a real simple problem, I have a 3 page process which puts data into 3 seperate MySQL tables and I create an ID on the first and wish to just pass this over to the second page. How do you pass over data from one page to the next?

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 21 May 2006 - 03:47 PM

do a hidden input in your form with the value you want to pass. or start a session and pass your variable through a session.
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#3 aceishigh

aceishigh
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 21 May 2006 - 03:59 PM

[!--quoteo(post=375787:date=May 21 2006, 10:47 AM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 21 2006, 10:47 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
do a hidden input in your form with the value you want to pass. or start a session and pass your variable through a session.
[/quote]

Hey thanks for the quick reply, maybe I should have been a little more specific :S ok, I don't think I can add a hidden input field because I am using a php generated random number and storing this as a business ID in one table. On the second page I want to add this businessID to a seperate table so they can be linked. So I wanted to post my $businessID field to the next page so this can be inserted into the table. So can you post businessID from page 1 to page2? I'm really stumped, I have thought long and hard about this think logically this is the best way of doing what I need.


#4 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 21 May 2006 - 05:09 PM

how are you moving from page 1 to page 2?
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)

#5 Julian

Julian
  • Members
  • PipPipPip
  • Advanced Member
  • 148 posts

Posted 23 May 2006 - 05:03 PM

[!--quoteo(post=375804:date=May 21 2006, 11:09 AM:name=Crayon Violent)--][div class=\'quotetop\']QUOTE(Crayon Violent @ May 21 2006, 11:09 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
how are you moving from page 1 to page 2?
[/quote]


Hi, I'm having the same problem. Here's what I'm doing: First Page includes data using a form. When I click submit I need to pass the ?id= variable in order to get the second form on the second page working with the id.


$insertGoTo = "Players_Include.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

Thanks

#6 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,017 posts

Posted 23 May 2006 - 07:13 PM

Structure like this

::page1.php::

<FORM action='page2.php'>

     <fields for form 1>

</FORM>


::page2.php::

<?php
    process form 1 data
    insert record
    get $newid
    ?>

   <FORM action='page3.php'>

     <hidden field name='newid' value='$newid>
     <fields for form 2>

    </FORM>

etc
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users