robert_gsfame
Members-
Posts
876 -
Joined
-
Last visited
Everything posted by robert_gsfame
-
need help with redirect to secured page and back if not a user
robert_gsfame replied to webguync's topic in PHP Coding Help
at the top of your page put <?php session_start(); ?> then never put the header() in the <body> so put everything at the top of your php page so it goes like this <?php session_start(); ?> <?php if($_POST['submit']) { if(!empty($_POST['textbox'])) { header("Location:page2.php"); } } ?> <html> <head> <body> <form name=form1 method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> <input type="text" name="textbox"> <input type="submit" name="submit"> </form> </body> </head> </html> IT WILL WORK 100% -
need help with redirect to secured page and back if not a user
robert_gsfame replied to webguync's topic in PHP Coding Help
then u can use <form action="<?php echo $_SERVER['PHP_SELF'];?>"> then u can validate every single input and put it at the top of your page eg: if($_POST['submit']) { if(!empty($_POST['text'])) { header("Location:page2.php"); } } so no submission when $_POST['text'] is empty -
i dont really get what you really want but as far as i notice If you are going to use $_POST['radio'] then you have to put your radio inside <form></form> and the another thing is that you can try to fill the form action with this <form action="<?php echo $_SERVER['PHP_SELF'];?>"> hope it helps
-
What error shown up?? $abc =sprintf("INSERT INTO my_db1 (username, password, firstname, company, email) VALUES ('%s', '%s', '%s', '%s', '%s'", mysql_real_escape_string($username), mysql_real_escape_string($password), mysql_real_escape_string($surname), mysql_real_escape_string($firstname), mysql_real_escape_string($company), mysql_real_escape_string($email))); $resultg = mysql_query($abc); this is what i notice...try this $abc =sprintf("INSERT INTO my_db1 (username, password, firstname, company, email) VALUES ('%s', '%s', '%s', '%s', '%s')", mysql_real_escape_string($username), mysql_real_escape_string($password), mysql_real_escape_string($surname), mysql_real_escape_string($firstname), mysql_real_escape_string($company), mysql_real_escape_string($email)); $resultg = mysql_query($abc); surely it works!
-
I have 2 frames just assume A and B And when i click on whatever records shown in frame A, i send it to another frame which frame B to display the detail of the record..currently i use <a href=blabla target=blabla> The problem is that i wish to load only the second frame without reload the whole page, so that it looks more professional and user friendly. How can i do this? can anyone give me an idea, logically thx
-
have u tried round($var,2)
-
Case like yours, you probably should use LIKE so instead of shoeName REGEXP '.*($getSearch).*' u can use shoeName LIKE '%$getsearch%' but if you still wish to use REGEXP, you can try this shoeName REGEXP '[[:<:]]".$getsearch."[[:>:]]'=1 100% must work! hope that helps
-
okay thx
-
I just want to ask the logic of making a chatroom. Is it correct if i prepare a table in MYSQL, php script to submit whatever words typed and use AJAX to refresh every second to be sure that all input displayed thx
-
yup..i notice this $findpostcode1=mysql_query("SELECT users.branch1, branch.id, FROM users, branch WHERE users.branch1=branch.id"); if you wish to join two tables then this is the format $query=mysql_query("SELECT table1.* FROM table1 JOIN table2 ON table1.user_id=table2.user_id WHERE table1.column='blablabla'"); here is the explanation "SELECT table1.*" - If you wish to get the whole records from table1 "table1 JOIN table2" - You join both tables table1 and table2 "ON table1.user_id=table2.user_id" - if both tables have user_id and you wish to connect both tables based on user_id "WHERE table1.column='blablabla" is the condition you wish to have. Hope that helps
-
hi, i am new to AJAX and i have problems when cope with query. How can i insert a record into database <script type="text/javascript"> function addcontact(str) { if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","page2.php?id="+str); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("ajaxpage").innerHTML=xmlhttp.responseText; }else{ document.getElementById("ajaxpage").innerHTML="<img src=loading.gif>";} } xmlhttp.send(); } </script> here is the html code <a href=javascript:void(0) onclick=addcontact('123')>add Contact</a> i wish to pass the value of 123 using $_GET to page2.php. in page2.php, it will execute the INSERT query and change the <a href=javascript:void(0) onclick=addcontact('123')>add Contact</a> into "Your contact has been added successfully" thx
-
dont get what you mean..are you going to send some bulk email to your enemy, arent you?
-
okay lets try this way instead of having this <textarea class="padform" name="address" cols="40" rows="15" id="address" tabindex="5"/> change the order into this <textarea name="address" id="address" cols="40" rows="15" tabindex="5" class="padform"/>
-
or die ('Unable to connect with Alumni Database. Try again later.); i Guess u miss another single quote or die ('Unable to connect with Alumni Database. Try again later.');
-
<textarea class="padform"name="address" cols="40" rows="15" id="address" tabindex="5"/> move that name a bit <textarea class="padform" name="address" cols="40" rows="15" id="address" tabindex="5"/>
-
if($_POST['submit']=="true") have u tried if(isset($_POST['submit'])) ??
-
If i am not wrong, you must set mob column NOT NULL this might be the problem, you are not correctly insert the record $mobile=$_POST['mob']; VALUES('$name','$address','$UCAS','$tel','$email','$mob' see the bold one
-
Incorrect integer value: '' for column 'ID' at row 1 Did u set ID column as autoincrement INT?? if yes then you have to modify the query and specify each column INSERT INTO UCASinterviews(name,address,address,UCAS,telephone,email,mobile,subject,interviewdate,interviewtime)VALUES ('$name','$address','$UCAS','$tel','$email','$mob','$subject','$interviewdate','$interviewtime','$parents'); hope that will solve the problem
-
nope...i have 2 frames. frame1 = assume page1.php frame2= assume page2.php i run a script so that frame2 will do like page2.php =>page3.php=>page2.php during the process of redirection using header() i wish to refresh page1.php which is in frame1
-
as long as it teaches you step by step. but to be an expert like people here will take time .
-
I have 2 frames and let say i have run certain script on frame1 and it redirect me to other page (execute script) and back again to frame1. What i want to ask is how can i refresh the other frame which is frame 2 once header() has been executed. Thx..
-
I have created a frameset but i dont know how to change the whole page into another page assume page5.html.... <frameset rows="26%,*" > <frame src="page1.html"> <frameset cols="30%,70%"> <frame src="page2.html"> <frame src="page3.html"> </frameset> thx
-
but the problem is that one of the page is pure php script only. so no html tag at all
-
I have this <body bgcolor="brown"> i wish to change bgcolor into white once print button being clicked window.print() how can i do that?? thx
-
So it should be mysql_query("INSERT INTO reservation_items(reservationID,productID,productQuantity) VALUES('$theReservationID','$itno','$quant')");