www.webdeveloper.com
Results 1 to 5 of 5

Thread: get data from a form

  1. #1
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Question get data from a form

    if a client form is filled out but there EEE is not filled out and i visit there page... how can i write a variable that says ... check the field 'EEENUMBER' in the input and if it's blank than echo an alert Must have EEE NUMBER...

    PHP Code:
    <tr><td>EEE</td><td><?php inp('EEENUMBER'); ?></td></tr> <?php if ($EEENUMBER <= 0) {
        echo 
    "Must have EEE NUMBER.";
    }
    ?>

    please help on this easy task.. I've gone brain dead today. Thanks in adavance.

  2. #2
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Red face

    PHP Code:
        <?php $_GET["DEANUMBER"]; if ($_GET['DEANUMBER <= 0']) {
        echo 
    "must have dea number";} 

    elseif (
    $_GET['DEANUMBER > 0']) {
        echo 
    "all is good";
    }
     
    ?>

    couldn't get this to work...

    need to echo an alert if there is not data in the field and do nothing if there is data..


    Help please.

  3. #3
    Join Date
    Jun 2011
    Location
    California
    Posts
    383
    the result is not a number it's a string... this finally worked for me... plus i had a syntax error i didn't see...



    PHP Code:
    $_GET["DEANUMBER"]; if (!$_GET['DEANUMBER'])
    {
        echo 
    "must have dea number";

    else 
    {
        echo 
    "all is good";


    How do i apply this script to a particular sql select statement

    like this one:

    select * from event.apo.patient_dg() where primname like '%RX%'

  4. #4
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,609
    First, just want to mention that this little bit is sort of non-code: it does not do anything (unless it might throw a notice-level warning if $_GET['DEANUMBER'] is not set):
    PHP Code:
    $_GET["DEANUMBER"]; 
    If we want to get really defensive about things:
    PHP Code:
    $errors = array();
    if( ! isset(
    $_GET['DEANUMBER']) or trim($_GET['DEANUMBER'] === '') {
       
    $errors[] = "DEA Nbr. must be entered.";
    }
    $deaNbr trim($_GET['DEANUMBER'];
    if( ! 
    ctype_digit($deaNbr) {
        
    $errors[] = 'DEA Nbr. must be all numbers.';
    }
    if( ! empty(
    $errors)) {
        
    // output error page, using $errors[] to get error message(s)
    }
    else {
        
    // go ahead and process request

    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  5. #5
    Join Date
    Jun 2011
    Location
    California
    Posts
    383

    Thanks Nogdog!!!

    Another question... it's a mix of jquery and php strings..

    I have 5 sql tables that i'm displaying results from, I've written a jquery statement that calls out the div parent and first children and parents table .siblings..

    like so:

    Code:
    $("#phone_book tr").click(function(){
    							var id = $(this).children().first().html();
    							var type = $(this).parents('table').siblings('div.module_header').html();
    							//alert(type);
    							window.location.href='index.php?q=patient/demographics/armdme&'+ patient + '=<?php $patient_id; ?>' '+ doctors + ' '+referral+ ' etc etc.... <confused on the url string here.
    						
    						});
    					});
    So when users hover it allows them to know what div category they're searching... well the window.location.href event needs to visit the correct card based on their selection..

    my categories are patients, doctors, alt doctors, referral, pharmacys...

    here's my code:

    HTML Code:
    	<div id='phone_book'>
    
    		<?php
    			echo "<div>";
    			echo "<div class='module_header'> Patients</div>";
    			echo lookup_gen::query_results_table("Select TOP 10 code, last + ', ' + first as name, phoneday, phonenight, cellnumber as Cell_Phone FROM " . event_table('patient_dg()') . " WHERE (phoneday is not null and phoneday <> '') or (phonenight is not null and phonenight <> '')");
    			echo "</div>";
    			
    			
    			echo "<br /><br />";
    			echo "<div class='module_header'> Doctors</div>";
    			echo lookup_gen::query_results_table ("Select TOP 10 CODE_, Last_ + ', ' + First_ as name, phone, fax FROM WARE.APS.FDME");
    			echo "<div class='fj'> - Alternative Address - </div>";
    			echo lookup_gen::query_results_table ("Select TOP 10 doctor_id, phone, fax FROM event.dbo.docr_alt_address WHERE (phone is not null and phone <> '') or (fax is not null and fax <> '')");
    			
    			echo "<div>";	
    			echo "<br /><br />";
    			echo "<div class='module_header'> Referral</div>";
    			echo lookup_gen::query_results_table ("Select TOP 10 CODE_,NAME_ as name, phone, fax FROM ARE.APS.RFDM");
    			echo "</div>";
    			
    			
    			echo "<div>";
    			echo "<br /><br />";
    			echo "<div class='module_header'> Pharmacy</div>";
    			echo lookup_gen::query_results_table ("Select TOP 10 id, name, call_back as Phone, fax_back as Fax FROM phar.dbo.chain");
    			echo "</div>";
    		?>
    	</div>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles