PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 19th, 2012, 11:17 AM
chrismarsden chrismarsden is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 25 chrismarsden User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 36 m 44 sec
Reputation Power: 0
Output information based on user id input:

output information based on user id input:

Hi Guys, I'm looking to have a user put a referance number in a form and then redirect them to a new page where based upon the ref she has added the other fields for that row will be output.

Eg: Page 1: Customer has form to input referance number:
PHP Code:
<form method="post" action="full_payment.php">
1. Your Referance Number <input type="text" name="MKREF"/><br/>
<
input type="submit" name="submit"/>
</
form


Page 2.
PHP Code:
<div id="homepage">
      <
section id="services" class="clear">
        <
article class="one_third">
        <
h2>Full & Final Payment</h2>
        
Thank you  [insert name here] <br>
        
You can use PayPal to make your full payment hereAlternatively you can use one of our installment plans if you wish to spread the cost.<br>
        </
p>
        
        </
article>
        <
article class="one_third">
         <
h2>Full & Final Payment</h2>
        
You can use PayPal to make your full payment hereAlternatively you can use one of our installment plans.<br><br>
        
<
form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<
input type="hidden" name="cmd" value="_s-xclick">
<
input type="hidden" name="hosted_button_id" value="M3QBVVQCANRHS">
<
table>
<
tr><td><input type="hidden" name="on0" value="Morgan Knightley Referance Num">Morgan Knightley Referance Number</td></tr><tr><td><input type="text" name="os0" maxlength="200" value="<?php echo $MKREF.''; ?>"></td></tr>
<
tr><td><input type="hidden" name="on1" value="SiP Referance Number">SiP Referance Number</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</
table><br>
<
input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_paynow_SM.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online."><br>

</
form>
        </
article


its the pull on the name i cant figure out... any help?

Reply With Quote
  #2  
Old December 19th, 2012, 12:06 PM
EEsterling EEsterling is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2011
Posts: 97 EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level)EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level)EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level)EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level)EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level)EEsterling User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Day 18 h 28 m 56 sec
Reputation Power: 49
"the pull on the name"? I presume you mean where you have "insert name here" you want something like <?php echo $name; ?>

Before that, you just need to have the code needed to extract from your storage (your database?) where you have associated the reference number to the name.

Reply With Quote
  #3  
Old December 19th, 2012, 02:17 PM
chrismarsden chrismarsden is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 25 chrismarsden User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 36 m 44 sec
Reputation Power: 0
Sorry. Should have made that clearer. That's the bit I'm after.

Reply With Quote
  #4  
Old December 20th, 2012, 03:50 AM
chrismarsden chrismarsden is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 25 chrismarsden User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 36 m 44 sec
Reputation Power: 0
this is what I have so far but i cant get it to out put the single name where i have requested the MKREF from the previous page.


PHP Code:
<?php 

 mysql_connect
("localhost""morgan""Im Not Stupid") or die(mysql_error()); 
 
mysql_select_db("morgan_knightley") or die(mysql_error()); 

 
$data mysql_query("SELECT NAME, REGISTRATION, SIPREF FROM SIPDEBTS WHERE MKREF = '$MKREF'"
 or die(
mysql_error()); 
 while(
$info mysql_fetch_array$data )) 
 
 
?> 


    <div id="homepage">
    
      <section id="services" class="clear">
        
        <article class="one_third">
        <h2>Full & Final Payment</h2>
        Thank you   <?php Print $info['NAME']; ?> <br>
        You have chosen to pay for your ticket in full for your car (Registration Number: $REGISTRATION )<br>
        You can use PayPal to make your full payment here, Alternatively you can use one of our installment plans if you wish to spread the cost.<br>
    

        </p>
        
        </article>

Reply With Quote
  #5  
Old December 20th, 2012, 04:46 AM
chrismarsden chrismarsden is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 25 chrismarsden User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 36 m 44 sec
Reputation Power: 0
I think i need the where function but it wont work for me??? any ideas?

Reply With Quote
  #6  
Old December 21st, 2012, 08:17 AM
chrismarsden chrismarsden is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 25 chrismarsden User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 36 m 44 sec
Reputation Power: 0
no one?

Reply With Quote
  #7  
Old December 21st, 2012, 08:41 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,869 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 22 h 59 m 40 sec
Reputation Power: 813
Hi,

I don't even see a definition for $MKREF. I hope you're not using the infamous register_globals?

And what's with this half-done "while" loop? You do know that a single row can be fetched by simply calling mysql_fetch_array()?

Reply With Quote
  #8  
Old December 21st, 2012, 08:55 AM
chrismarsden chrismarsden is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 25 chrismarsden User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 36 m 44 sec
Reputation Power: 0
im not excellent at PHP.

I have included code below which might help, basicly i want the user to put in their ref number, the database to get the ref that is assigned to and pull other bits of data that ref is assigned too:

PHP Code:
 I can get it to carry over the MKREF number but can’t get it to output the details that ref is assigned to.



Page 1 – full_payment_pass.php

<form method="post" action="full_payment.php">

1. Your Morgan Knightley Referance Number <input type="text" name="MKREF"/><br/>



<
input type="submit" name="submit"/>

</
form>


Page 2full_payment_catch.php

<?php 


$MKREF 
$_POST['MKREF']; 


?>


Page 3 full_payment.php

<?php
include 'full_payment_catch.php';
?>
<?php 

mysql_connect
("localhost""morgan_knightley""password here") or die(mysql_error()); 
 
mysql_select_db("morgan_knightley") or die(mysql_error()); 

$data mysql_query("SELECT NAME, REGISTRATION, SIPREF FROM SIPDEBTS WHERE MKREF = '$MKREF'"
 or die(
mysql_error()); 
 while(
$info mysql_fetch_array$data )) 
 
 
?> 


    <div id="homepage">

      <section id="services" class="clear">

        <article class="one_third">
                                <h2>Full & Final Payment</h2>
                                Thank you   <?php Print $info['NAME']; ?> <br>
                                You have chosen to pay for your ticket in full for your car (Registration Number: $REGISTRATION )<br>
                                You can use PayPal to make your full payment here, Alternatively you can use one of our installment plans if you wish to spread the cost.<br>
    

                                </p>
        
        </article>
        <article class="one_third">
                <h2>Full & Final Payment</h2>
                                You can use PayPal to make your full payment here, Alternatively you can use one of our installment plans.<br><br>
        
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="M3QBVVQCANRHS">
<table>
<tr><td><input type="hidden" name="on0" value="Morgan Knightley Referance Num">Morgan Knightley Referance Number</td></tr><tr><td><input type="text" name="os0" maxlength="200" value="<?php echo $MKREF.''?>"></td></tr>
<tr><td><input type="hidden" name="on1" value="SiP Referance Number">SiP Referance Number</td></tr><tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</table><br>
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_paynow_SM.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online."><br>

</form>
        </article> 

Reply With Quote
  #9  
Old December 21st, 2012, 09:04 AM
Jacques1's Avatar
Jacques1 Jacques1 is offline
pollyanna
Click here for more information.
 
Join Date: Jul 2012
Location: Germany
Posts: 1,869 Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level)Jacques1 User rank is Lieutenant General (80000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 22 h 59 m 40 sec
Reputation Power: 813
OK, so there's a single row for a particular MKREF value? In this case, simply call mysql_fetch_array( $data ) to fetch the row. You don't need a "while" loop, because you don't need to repeat the code multiple times.

If it still doesn't work, output the query and see what it says:
PHP Code:
echo "SELECT NAME, REGISTRATION, SIPREF FROM SIPDEBTS WHERE MKREF = '$MKREF'";
$data mysql_query("SELECT NAME, REGISTRATION, SIPREF FROM SIPDEBTS WHERE MKREF = '$MKREF'"


Execute the query separately in phpmyadmin (or whatever it is you're using).

There are several issues with your code regarding obsolete database functions and security holes, but it probably makes sense to do that later ...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Output information based on user id input:

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap