Welcome! Log In Create A New Profile

Advanced

Save Button!

Posted by RynoE 
Announcements Last Post
Announcement myUnisa availability 21 to 24 March 2019 03/17/2019 02:24PM
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
avatar Save Button!
October 15, 2009 03:52PM
Hi its me again!

I started with my project today have been so busy at work just didn't have the time been working till 9 every night the laast few week but i still have 15 day to complete it so here goes!

i have a small problem and most of u are probably going to think its dump but here go's

i wrote a function to save my new student registration details in so i pass the values to the function and it does the work and returns me a successful on unsuccessful this code works perfectly! here comes my problem.

I am struggling to execute my function on my submit button click event? confused smiley

PLEASE HELP!

i know its something stupid but rather be fool for 5minits that i fool for the rest of my life hehe!

Ryno
avatar
Mac
Re: Save Button!
October 15, 2009 04:33PM
Ahem --- it might help if you post some code smiling smiley
Is it sent (if not look for a opening and closing <form> tag)
If - did you catch the variable, and have you included it in your function - funtion($caught) { //use $caught inside the function).


Point is - do some error checking by echoing everywhere - outside the function, then inside etc until you figure out where the problem lies
avatar Re: Save Button!
October 16, 2009 08:01AM
Yeah i must admit Mac, error checking by echoing variable values etc really did help me when I was struggling with some code...

Debugging techniques are essential, and i figure you probably develop better and better techniques as you go along.
avatar Re: Save Button!
October 16, 2009 08:36AM
okay guys here is sample code

THIS IS MY PHP FUNCTION
<?php

function test()
{
echo "function worked";
}

?>

NOW I WANT TO EXECUTE THAT FUNCTION FROM THIS BUTTON

THIS IS HOW I TRIED IT BUT NO LUCK
<input type="button" name="Test1" value="Test" onclick="<php test(); ?>">


CAN I EXECTE THE FUNCTION IN THIS WAY???


Thanks
Ryno
avatar Re: Save Button!
October 16, 2009 08:59AM
and i have now try someting like this but still not working

<form action="<?=$_SERVER['PHP_SELF'];?>" method="post">
<input type="button" name="submit" value="Submit">
</form>


<?php

if(isset($_POST['submit'])) {
test();
}

function test()
{
PRINT "function worked";
}

?>
avatar Re: Save Button!
October 16, 2009 10:22AM
i got iT working thanks for the help!!!!!!!!!!!!!!!!!!!!!!!!! grinning smiley


God Bless!
Ryno spinning smiley sticking its tongue out
Re: Save Button!
October 20, 2009 11:27AM
This helped me too....

Thanks
Sorry, only registered users may post in this forum.

Click here to login